本人VB新手,求帮助,代码如下Dim RstSQL As New ADODB.Recordset
Dim sql As String
Dim txt As String
txt = Text1.Text
With RstSQL
        .ActiveConnection = CnnDSN
        .LockType = adLockOptimistic
        .CursorType = adOpenStatic
        .Source = "UPDATE Lottery_Table SET Checked='1',Person_Level='" & txt & "',Award_Data = " & Format(Now(), "YYYY/MM/DD HH:MM:SS") & "  Where Person_ID = " & Int(frm_Main.Text10.Text) & ""
        .Open
    End With错误是在把日期写入Award_Data字段中,Award_Data字段的属性是文本
显示错误:语法错误(操作符丢失)

解决方案 »

  1.   

    .Source = "UPDATE Lottery_Table SET Checked='1',Person_Level='" & txt & "',Award_Data = '" & Format(Now(), "YYYY/MM/DD HH:MM:SS") & "' Where Person_ID = " & Int(frm_Main.Text10.Text) 
      

  2.   

    把这个
    "UPDATE Lottery_Table SET Checked=1,Person_Level='" & txt & "',Award_Data = '" & Format(Now(), "YYYY/MM/DD HH:MM:SS") & "' Where Person_ID = " & Int(frm_Main.Text10.Text) 
    解析出来放到数据库里面直接运行你的checked是不是boolean? 
      

  3.   

    不会是checked和Person_Level的问题,因为Award_Data表是后加的,在没有尝试写入时间以前UPDATE是完全正常的
      

  4.   

    好吧,我太愚蠢了,麻烦各位了,字段名的Award_date写成data了。
      

  5.   

    cnndsn.execute "UPDATE Lottery_Table SET Checked='1',Person_Level='" & txt & "',Award_Data = '" & Format(Now(), "YYYY/MM/DD HH:MM:SS") & "' Where Person_ID = " & Int(frm_Main.Text10.Text) & ""