Private Sub Form_Load()
Dim objConnection
Dim strConnectionString
Dim Ingvalue
Dim strSQL
Dim objCommand
strConnectionString = "Provider=MSDASQL;DSN=SampleDSN;UID=;PWD=;"
Ingvalue = HMIRuntime.Tags("yhy").Read
strSQL = "INSERT INTO WINCC(Number)VALUES(" & Ingvalue & ");"
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
yhy变量里放入的是英文字符,就会出现 Microsoft Access Driver 参数不足,参数为1 的提示,但是如果把yhy变量改成数字的话就没有问题,怎么解决??急急急!!