不知道为什么第2个SQL语句报UPDATA语句错误。可是我在数据库的查询里可以用呢?写到VB里就报错误了~
checksql = "update checklist set checkp2= '" & Form1.pName & "',check2= '" & Str(Check2.Value) & "',checkideal2= '" & _
                Text4.Text & "',checkdate2= #" & Now & "# where checklist.testid=" & Form8.DataGrid1.Text & " and checklist.编号=" & code & ""
            'Debug.Print checksql
            dbconn.Execute (checksql)
            txtsql = "update testdes set check= '" & Str(Check2.Value) & "' where testdes.编号=" & Form8.DataGrid1.Text & ""
            dbconn.Execute (txtsql)
            MsgBox "试题审核完毕!", , "提示消息"
            Text4.Enabled = False
            Check2.Enabled = False
            Command3.Enabled = False

解决方案 »

  1.   

    Form8.DataGrid1.Text 没有单引号吧,拼 SQL 时字符串两边要加单引号。
      

  2.   

    Form8.DataGrid1.Text   加了单引号就无法识别的数据类型了。
      

  3.   

    Form8.DataGrid1.Text   加了单引号就无法识别的数据类型了。
      

  4.   

    编号字段的数据类型是数字还是文本?是文本的话应该改成这样
    txtsql = "update testdes set check= '" & Str(Check2.Value) & "' where testdes.编号='" & Form8.DataGrid1.Text & "'"
    dbconn.Execute (txtsql)