为什么Update总是提示语法错误?
两种写法:程序代码:
Dim SQL As String Set Con = New ADODB.Connection Con.Open "provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & SetUp.Text(0) & "\Data.accdb" SQL = "update 数据库信息 Set 状态='" & MDI.StatusBar.Panels(2) & "' Where ID=1" Con.Execute SQL Con.Close Set Con = Nothing上面的代码一直显示语法错误,下面的能正确
程序代码:
Set Con = New ADODB.Connection Con.Open "provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & SetUp.Text(0) & "\Data.accdb" Set Rs0 = New ADODB.Recordset Rs0.Open "select * from 数据库信息", Con, 3, 3 Do While Not Rs0.EOF If Rs0.Fields("ID") = 1 Then Rs0.Fields("状态") = MDI.StatusBar.Panels(2) Exit Do End If Rs0.MoveNext Loop Rs0.Close Con.Close Set Rs0 = Nothing Set Con = Nothing谁能告诉我这是为什么?要怎么写?
[ 本帖最后由 mpy2003 于 2013-4-16 09:19 编辑 ]