Dim conn
Dim ssql
Dim ors
Dim ocom
Dim con
Dim MSHFGrid
Dim ADODC
Dim data1,data2,data3
'MsgBox"....."
data1="123"
data2="234"
data3="345"
con="Provider=SQLOLEDB.1; Integrated Security =SSPI;Persist Security Info=False; Initial Catalog=testdata;Data Source=.\WINCC"
Set conn=CreateObject("ADODB.Connection")
conn.ConnectionString=con
conn.Cursorlocation=3
conn.open
MsgBox (con)
'MsgBox"....."
ssql="insert into 个人信息 VALUES ('"&data1&"','"&data2&"','"&data3&"');"
Set ors=CreateObject("ADODB.RecordSet")
Set ocom=CreateObject("ADODB.Command")
Set ocom.ActiveConnection=conn
ocom.commandtype=1
ocom.CommandText=ssql
Set ors=ocom.Execute
Set ors=Nothing
conn.close
Set conn=Nothing
执行到CONN,OPEN时错误
最佳答案
手动创建testdata这个表格了吗?
提问者对于答案的评价:
问题已解决,数据库源的问题
原创文章,作者:more0621,如若转载,请注明出处:https://www.zhaoplc.com/plc313425.html