小弟做了一个按钮,把帮助里的例子抄了一遍。如下:
Sub OnLButtonDown(Byval Item, Byval Flags, Byval x, Byval y)
Dim objconnection
Dim strconnectionstring
Dim lngvalue
Dim objcommand
Dim strsql
strconnectionstring="provider=msdasql;dsn=LLL;uid=;pwd=;"
lngvalue=HMIRuntime.Tags("ma1").Read
strsql ="insert into user(value)values(" & lngvalue & ");"
Set objconnection=CreateObject("ADODB.connection")
objconnection.connectionstring=strconnectionstring
objconnection.open
Set objcommand=CreateObject("ADODB.command")
With objcommand
.activeconnection=objconnection
.commandtext=strsql
End With
objcommand.execute
Set objcommand=Nothing
objconnection.close
Set objconnection=Nothing
End Sub
注:ODBC DSN是LLL,表是user,只有一列value(int)。服务只开脚本。在gsc
对话框里显示如下:
[Microsoft][ODBC Microsoft Access Driver] INSERT INTO 语句的语法错误
困惑了好几天了,哪位好心人帮忙看一下,有什么错误吗?
不盛感谢!!!!