我想更新数据库中的符合条件的纪录如:
用的是sql server
我这样写不行!dim cmdtext as adodb.command                     dim rst as adodb.recordset                     Dim tempstr As String, table As String                   cmdcookroomfood.ActiveConnection = D_cnn
      cmdcookroomfood.CommandType = adCmdText
      cmdcookroomfood.CommandTimeout = 15
      
      cmdcookroomfood.CommandText = _
          "update cookroomfood set printed = '0' and press = '1' where     tableno = '" & table & "'and foodcode = '" & tempstr & "' and completed = '0'"
    rst =  cmdcookroomfood.Execute在rst =  cmdcookroomfood.Execute报错!
请问如何操作可以实现?

解决方案 »

  1.   

    哦,实例化了吗
    set rst =  cmdcookroomfood.Execute
      

  2.   

    cmdcookroomfood.CommandText = _
              "update cookroomfood set printed = '0',press = '1' where     tableno = '" & table & "'and foodcode = '" & tempstr & "' and completed = '0'"
      

  3.   

    cmdcookroomfood.CommandText = _
              "update cookroomfood set printed = '0',press = '1' where tableno = '" & table & "' and foodcode = '" & tempstr & "' and completed = '0'"
    set rst =  cmdcookroomfood.Execute