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

Help on SQL replace field contents

Status
Not open for further replies.

polymathinc

Programmer
Mar 19, 2007
10
US
I am working on my first project with an SQL server database (updating data stored in SQL database).
I have created ODBC connection on the computer

in VFP
I have created database
I have created connection
I have created Remote View
I can use the remote view and BROWSE the data.

Here is my sample code

OPEN DATABASE scanner
USE invmaster IN 1
USE sorcontrol IN 2
SET MULTILOCKS ON
= CURSORSETPROP('Buffering', 5, 'sorcontrol' )
SELECT sorcontrol
replace nextordnum WITH nextordnum+1
=tableupdate(.T.)

This does not seem to write the data back into the tables on the SQL server.

Can someone please point me in the right direction? Or perhaps send me a small snippet of code that I can use to test on my server setup.

Appreciate the help.

Dave G.
 
I have created Remote View

Is the remote view updatable. If created in the view designer, Check the box "send SQL update" in pane "update criteria"
 
Hi Dave,

As well as making the view updatable, you might have to issue TABLEUPDATE() twice: once to update the view itself, and once to send the updates back to the server. (At least, that's true with row buffering; I'm not sure if it applies to table buffering.)

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

My Visual FoxPro site: www.ml-consult.co.uk
 
I do not see a Begin Transaction
or an
End Transaction
in your code add these lines
.....
select SorControl
Begin TransAction
replace ......
if tableupdate(.t.)
End transaction
else
rollback
endif





David W. Grewe (Dave)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top