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 Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need vfp Guru help.

Status
Not open for further replies.

kueyiar

Programmer
Mar 19, 2002
47
HN
I'm having trouble updating a table with a view. The view has a pk and all updatable fields set, as well as the send sql updates tick.
The thing is, that when a new record is added, and i issue a =tableupdate(.t.), the new record is added with no trouble, but when i use the view to modify any existing record and try =tableupdate(.t.), the update doesn't take place even though it doesn't report an error, and when i try a =requery(), 'sintax error' is displayed. If i issue a =tablerevet(.t.) then the record goes back to normal.
I'm not able to modify any given existing record with the view.
I really need the help !
Thanx
 
What sort of table(s) are you connecting to? (e.g. VFP, SQL Server, Oracle, etc.)

How are you connecting? (e.g. VFP table - local view, ODBC, OLE DB)

How did you create this view? (View designer or code?)

What version and service pack of VFP are you using?

Rick
 
Rick,
I'm connecting to a vfp table, through a local view, and i designed the view with view designer. I'm running vfp8 spk1.

Antonio
 
I'm thinking that you are using Optomistic Table (5) which won't throw an error. You have to test the return value.
llSuccess = TABLEUPDATE(.T.)
? llSuccess
Temporarily change to Optomistic Row (3) to see if you get an error.

Regards,

Mike
 
Mike,
I have it on (3), tried changing it to (5) as well, but still won't update. Tried you routine and llSuccess returns .f., Any other suggestions ?

Antonio
 
kueyiar

Go back to the view designer and check the update criteria, the fields you need uddated should be selected.

Mike Gagnon

If you want to get the best response to a question, please check out FAQ184-2483 first.
 
Mike,
Yes i've checked all the updatable fields, specified pk, selected send updates tick as well..
Antonio
 
Hello Kueyiar.

>> but when i use the view to modify any existing record and try =tableupdate(.t.), the update doesn't take place even though it doesn't report an error <<

If you have the base table from the view open and the base table is table buffered, you need to tableupdate() the table as well as the view in order for the update to succeed.

Marcia G. Akins
 
when i try a =requery(), 'sintax error' is displayed

Exactly what syntax error?

Are you using a framework?

What controls are bound to your view?

Are you using transactions?

I'm just a bit confused. If you can append a record you should also be able to modify them.

Regards,

Mike
 
thats the thing mike , it just says that "syntax error"
It's just a simple view, no framework or transactions.
I have 3 textboxes bound to the view, two character and 1 numeric just like the table
Thats why i'm comfused myself, why can i append a record and why can't i modify it.
I really have run out of ideas. !! :(
 
More thoughts.
Since you get a syntax error on REQUERY(), my thought is that you have SELECTed away from your view or closed your view by USEing something else without SELECT 0. I would add the alias information to the update.
Code:
llSuccess = TABLEUPDATE(1,.F.,"ViewAlias")
? llSuccess
Are you using Private DataSession on your form?
Did you use a wizard to make the form?

Regards,

Mike
 
Yes i have a private datasession, and i'm making all the forms myself.

antonio
 
Hi Antonio,

Have you verified that ypu are SELECT'd to the proper alias when you do your TABLEUPDATE()?
You can put MESSAGEBOX(ALIAS()) on the line prior to the TABLEUPDATE() and the REQUERY() to verify.

Regards,

Mike
 
Yes i have, and the correct vies is selected. I issueda
varsuc=TABLEUPDATE(.t.)
?varsuc
to see what it returns but it allways .f.
 
Hi.

You can verify if you have the same view or table opened in two different datasession. Sometimes, it cause conflics.

Also, try Rlock() before modifying the record (and then unlock)

Hope this help

Nro
 
Have you tried:
Code:
varsuc=TABLEUPDATE(.t.,.f.,"ViewAlias")
?varsuc
yet?

Regards,

Mike
 
Yes i tried it as well, but no luck, any other suggestions ?
Antonio
 
If these three fields are in the same table, try binding to them directly instead of using the view. (buffering will still work)

Regards,

Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top