General information
Category:
Databases,Tables, Views, Indexing and SQL syntax
I am trying to use SQL server for the first time and I am having trouble.
Server box: Windows 2000 Advanced server; SQL 2000 running
System DSN has been defined for SQL
I have writen a small .prg using the Northwind database that comes with SQL2000. Using a remote view, I can update the 'products' table, however I cannot get the SQLCOMMIT() command to actually update the table.
Here is the code:
BLR = SQLCONNECT('sql')
TT='select * from products'
SQLEXEC(BLR,TT,'tmpfile')
SQLSETPROP(BLR,"Asynchronous",.F.)
SQLSETPROP(BLR,"BatchMode",.T.)
SQLSETPROP(BLR,"Transactions",2)
cursorsetprop('SendUpdates',.t.,'tmpfile')
cursorsetprop('Tables',products)
replace tmpfile.productname with 'test'
TTT=SQLCOMMIT(BLR)
wait window " sqlcommit returned " + alltrim(str(ttt))
SQLDISCONNECT(BLR)
The 'TTT' variable ALLWAYS returns a '1', but when I open another connection to check the table, no updates have been written!
I am VERY new to using SQL on the back end and have absolutely no idea what is wrong. What I need is a sample of code that opens a sql table, changes a field, and actually updates the sql table.
Thanking you in advance....
Brian Roberts
(a very confused programmer)
Next
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only