rst.Open "Select * from 订单表 where 订单号='" & dingdannum & " '", cnn, adOpenKeyset, adLockOptimistic
If rst.Fields("订单名") = False Then
    rst.AddNew
    rst.Fields("订单名") = savepathnum
    rst.Update
    rst.Close
   End If这一句应该怎么写?
在线等待,谢谢

解决方案 »

  1.   

    rst.Fields(0)
    或者
    rst("订单名")这个字段应该是字符串吧?
    要判断有没有记录应该rst.EOF or rst.BOF
      

  2.   

    你确定你的recordset里面有值?可以测eof或者recordcount
      

  3.   

     当Cnn.CursorLocation   =   adUseClient   
     可用
      If rst.eof Then
      或 if rst.recordcount <1 
      

  4.   

    rst.Open "Select * from 订单表 where 订单号='" & dingdannum & " '", cnn, adOpenKeyset, adLockOptimistic
    If rst.recordcount=0 Then
      rst.AddNew
      rst.Fields("订单名") = savepathnum
      rst.Update
      rst.Close
    End If
      

  5.   

    if rs.eof and rs.bof then 
      你的代码
    endif