主题:无法更新SQLserver
下面这段代码是试验性质的,正常运行,但sqlserver上的数据始终不能添加,本人新接触sqlserver,不是很懂,如果直接用sqlexec插入sqlserver中的tbuser则没问题,我想问问为什么不能把本地表tmpuser中的数据更新至服务器,请高手们不吝赐教-----
nhandle=SQLSTRINGCONNECT("driver=sql server;server=admin;uid=sa;pwd=sa;database=xisheng")
IF nHandle>0
=SQLSETPROP(nHandle,"Asynchronous",.F.) &&设置为同步连接
=SQLSETPROP(nHandle,"Transactions",2) &&开始人工事务处理
SQLEXEC(nhandle,"select * from tbuser","tmpuser") &&读取记录到本地表tmpuser
INSERT INTO tmpuser (xs_user,xs_password,xs_level,xs_bm) VALUES ('admin','2','2','2')
=TABLEUPDATE(.F.,.F.,"tmpuser")
=SQLCOMMIT(nHandle)
WAIT WINDOW "添加用户成功!"
=SQLSETPROP(nHandle,"Transactions",1) &&结束人工事务处理
endi
nhandle=SQLSTRINGCONNECT("driver=sql server;server=admin;uid=sa;pwd=sa;database=xisheng")
IF nHandle>0
=SQLSETPROP(nHandle,"Asynchronous",.F.) &&设置为同步连接
=SQLSETPROP(nHandle,"Transactions",2) &&开始人工事务处理
SQLEXEC(nhandle,"select * from tbuser","tmpuser") &&读取记录到本地表tmpuser
INSERT INTO tmpuser (xs_user,xs_password,xs_level,xs_bm) VALUES ('admin','2','2','2')
=TABLEUPDATE(.F.,.F.,"tmpuser")
=SQLCOMMIT(nHandle)
WAIT WINDOW "添加用户成功!"
=SQLSETPROP(nHandle,"Transactions",1) &&结束人工事务处理
endi