Private Sub Command5_Click()If t8.Text = "" Then
    MsgBox "请选择要更新的会员", , "更新缺少对象"
    
Else
    Dim j As String
    j = "update [user] set xingming='" + T1.Text + "',xingbie='" + Combo1.Text + "',dianhua='" + T4.Text + "',nianling='" + t3.Text + "',dianhua='" + T4.Text + "',qq='" + T5.Text + "',youxiang='" + T6.Text + "',dizhi= '" + T7.Text + "',zhaopian=" & pic & where id='" + t8.Text + "'"
    objCn.Execute j, isupdated
    
    '如果更新成功,返回更新条数大于0
    If isupdated > 0 Then
        MsgBox "更新成功", , "系统信息"
        
        '调用清空文本框的函数
        cll
        
        '先检测连接是否关闭,如果没关闭则关闭
        If objCn.State <> adStateClosed Then objCn.Close        Set objCn = Nothing
        Set objRs = Nothing
    
         '调用遍历会员的资料函数
        op
    Else
        MsgBox "更新失败", , "系统信息"
    End If
End If
End Sub

解决方案 »

  1.   


    字符串多行的写法
    dim Stra as string
    stra="aaaa"  & _
     " bb" & "'"& text1.text &"'"debug.print stra也可以stra="aaa"
    stra=stra & " bb" & "'"& text1.text &"'"debug.print stra
      

  2.   

        j = "update [user] set xingming='" + T1.Text + "',xingbie='" + Combo1.Text + "',dianhua='" + T4.Text + "',nianling='" + t3.Text + "',dianhua='" + T4.Text + "',qq='" + T5.Text + "',youxiang='" + T6.Text + "',dizhi= '" + T7.Text + "',zhaopian=" & pic & " where id='" + t8.Text + "'" 你有两个dianhua是不是重复了,另外where前面需要一个"
      

  3.   

    dianhua这个字段改了以后还显示操作符丢失
      

  4.   

    where前我也+了“了,可是怎么还说是操作符丢失啊
      

  5.   

    你把j debug出来看看到数据库里面直接运行一下可能你的id不需要加单引号吧
      

  6.   

    啊,是我的马虎
        j = "update [user] set xingming='" + T1.Text + "',xingbie='" + Combo1.Text + "',nianling='" + t3.Text + "',dianhua='" + T4.Text + "',qq='" + T5.Text + "',youxiang='" + T6.Text + "',dizhi= '" + T7.Text + "',zhaopian='" & pic & " ' where id=" & CStr(t8.Text) & ""
        objCn.Execute j, isupdated这样就通过了,ID是自动编号,所以要整型