Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form Update - using Remote View mysql odbc

Status
Not open for further replies.

white605

Technical User
Jan 20, 2003
394
US
When i create a database and put a remote view from the avaliable sources selecting a mysql connection i created with the connector, I can browze the view and see/navigate the records.
When i use this database/view for the source of a form, put elements on it, create a next/previous button, i can see the status record 1/2 changing but the form does not update.
I have buffering set to 3 and this view is not updating the source tables only gathering data from two tables on a server.
Code in next button
if .not. eof()
skip
else
wait wind [end of file]
endif
thisform.refresh()

what am i missing?
thanks in advance
wjwjr

This old world keeps spinning round - It's a wonder tall trees ain't layin' down
 
Like Olaf, I was going to say you need to refresh the form, but I see you are already doing that.

The other thing you need is to SELECT the view at the start of your Click event. Remember, you are working in an event-driven environment; you have no way of knowing which table or view is current when the user clicks the button, so you have to explicitly select it each time.

One other point: Given you are not updating the view, there's no point in buffering it. Buffering will have no effect. But that won't be the cause of your problem.

Mike


__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Sorry, overlooked that you already do a refresh(). Yes, the only other issue I see as Mike says, you're not explicitly skipping in the view alias, but any alias which is the current selected alias.

Bye, Olaf.
 
Thanks for the reply. I will try the select in the click event of the button.
Since i am only going to process the data locally I may try this also.
psudo!
open data xxx
use remoteview
copy to temp.dbf for condtion
use temp
process and print

One other question that either i cannot remember or never knew was -
The columns in the mysql table are varchar(255) and they come thru to vfp as memo fields. Is there a simple way to change this without parsing the memo file...ie convert memo to string. I searched but all i could see was to:
put the memo in an array of lines
loop thru the lines and build a string, then store it


This old world keeps spinning round - It's a wonder tall trees ain't layin' down
 
We're merely talking about a SELECT of the workarea, that is not an SQL-Select. That is I think your pseudo code was for the click event.

The change for the "next" button simply needs a
SELECT alias before the rest of the code, to activate the view alias.

In regard to memo: In Foxpro the limit is c(254) or v(254) for char/varchar fields. therfore you'd simply need to select LEFT(field,254) or live with memo field. A memo field on the foxpro side doesn't hurt that much, does it? In a grid put an editbox instead of a textbox and you're done, just need to limit input to a maxlegth of 255 chars.

Bye, Olaf.
 
Thanks Olaf,
I did get the select part as i have done it before
Ill give the left(field,254) a try.
wjwjr

This old world keeps spinning round - It's a wonder tall trees ain't layin' down
 
White,

I can't see any advantage in opening the remote view and then copying the contents to a temp cursor. It won't solve your original problem, and adds unnecessary complications.

Regarding the use of LEFT(.., 254) to get rid of the memo field, you can do that within the view itself. If you are using the view designer, just create an expression based on the field, and give it the same name as the field itself. If you are creating the view through code, add:
LEFT(MyField, 254) AS MyField
to the field list in the SELECT.

Mike



__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro tips, advice, training, consultancy
Custom software for your business
 
Mike, I understand
Thanks!
wjwjr

This old world keeps spinning round - It's a wonder tall trees ain't layin' down
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top