Private rs As New ADODB.Recordset
Private cData As New CDataBase
打开数据库
sql = "update worktime set work_time with '" + "5:00"+ "'"+ "where          Userid='" + txtid.Text + "'"
    rs.Open sql, cData.db
   老是出错,,给高手给出答案把,,,,,

解决方案 »

  1.   

    dim cn as new ADODB.Connection
    cn.open ...sql = "update worktime set work_time = '" + "5:00" + "'" + " where Userid = '" + txtid.Text + "'"cn.execute sql
      

  2.   

    应该如此:
    sql = "update worktime set work_time = " & "5:00" & " where Userid = '" & txtid.Text & "'"
      

  3.   

    sql = " update worktime set work_time = '" + "5:00" + "' " _
        & " where Userid = '" + txtid.Text + "'"
    rs.execute sql
    提醒在你有多条修改语句同时对库修改时,建议用事务来控制
      

  4.   

    补充:rs.execute 中需定义rs为连接而非记录
    dim rs as ADODB.Connection
    set rs=new ADODB.Connection
      

  5.   

    用connection.execute(update语句)来执行,
    如果是多用户环境建议用事务来完成
      

  6.   

    这样就可以:
    sql = "update worktime set work_time = '5:00' where Userid = '" & Trim(txtid.Text) & "'"
    如果是你自己确定的参数,就不用去加"&"还是"+"了.
      

  7.   

    同意楼上说的
    用 & 它+ 是 JAVA中的
      

  8.   

    dim cn as new adodb.connection
    cn.execute "update worktime set work_time with '" + "5:00"+ "'"+ "where          Userid='" + txtid.Text + "'"
      

  9.   

    dim cn as new adodb.connection
    cn.execute "update worktime set work_time with '" & "5:00"+ "'" & "where       Userid='" & txtid.Text & "'"