为啥把帮助里的例子写进去也不行啊?老提示出错:“s cript debugger could not be started! ”
但是能写数据到acess数据库里去代码如下:
Dim objConnection
Dim strConnectionString
Dim lngValue
Dim strSQL
Dim objCommand
Dim Name
Name="222"
strConnectionString = "Provider=MSDASQL;DSN=bianliang;UID=sa;PWD=;"
'字符串连接到数据库
strSQL = "INSERT INTO bianliang (seach) VALUES ("& Name &");"
'sql语句将new插入bianliang的变量名的列
Set objConnection = CreateObject("ADODB.Connection")
'将objconnection定义成adodb的连接
objConnection.ConnectionString = strConnectionString
'将数据库连接字符串赋值给adodb.objconnection
objConnection.Open
'打开连接数据库
Set objCommand = CreateObject("ADODB.Command")
'将objcommand定义成adodb的命令
With objCommand
.ActiveConnection = objConnection
.CommandText = strSQL
End With
objCommand.Execute
Set objCommand = Nothing
objConnection.Close
Set objConnection = Nothing