主题:问个vb6使用access数据库更新数据的问题
问题是 一个更新某字段的sql (更新多个记录), 在vb里面执行的时候没有错误,没有效果.不知道大家谁碰到过, 或者知道如何解决. 如果在条件语句换成 where id = '303'执行一切正常, 其他的select, insert的sql语句执行也都很正常。 我查资料好像和什么 沙盒模式可能有关系,实在搞不定了。。。。。。
具体代码如下:
Dim sql As String
Dim xxx As Variant
Dim pathdb As String
Dim myConn As New ADODB.Connection
pathdb = Trim(App.Path) & "\db1.mdb"
With myConn
If .State = adStateOpen Then .Close
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pathdb & ";Persist Security Info=False"
.Open
.CommandTimeout = 300
End With
sql = "UPDATE Table01 SET id='304' WHERE id Like '303*'"
Debug.Print sql
myConn.Execute (sql)
具体代码如下:
Dim sql As String
Dim xxx As Variant
Dim pathdb As String
Dim myConn As New ADODB.Connection
pathdb = Trim(App.Path) & "\db1.mdb"
With myConn
If .State = adStateOpen Then .Close
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & pathdb & ";Persist Security Info=False"
.Open
.CommandTimeout = 300
End With
sql = "UPDATE Table01 SET id='304' WHERE id Like '303*'"
Debug.Print sql
myConn.Execute (sql)