strSql = "select * from INFO where EquipID = " & "'" & txtEquipID.Text & "'"
    
    rs.Open strSql, cnn, 3, 3
    
    If rs.EOF = True Then
        rs.AddNew
        rs.Fields("EquipID") = txtEquipID.Text
        rs.Fields("equipCategory型") = equipCategory
        rs.Fields("State") = cmbState.Text
        rs.Fields("Notes") = txtNotes.Text
        rs.Fields("Recorder") = txtRecorder.Text
        rs.Fields("Date") = txtDate.Text
        rs.Fields("Group") = txtGroup.Text
        rs.Fields("keeper") = txtkeeper.Text
        rs.Update
        rs.Book = rs.LastModified
        rs.Close
        MsgBox "ok!", , "manage"
好像不能直接用rs.Book = rs.LastModified指向最新更新的那条记录阿,高手指点下阿

解决方案 »

  1.   

    调用了 AddNew 后一直是指向新增纪录,不需要再次定位了。
      

  2.   

        strSql = "select * from INFO where EquipID = " & "'" & txtEquipID.Text & "'" 
        
        rs.Open strSql, cnn, 3, 3 
        
        If rs.EOF = True Then 
            rs.AddNew 
            rs.Fields("EquipID") = txtEquipID.Text 
            rs.Fields("equipCategory型") = equipCategory 
            rs.Fields("State") = cmbState.Text 
            rs.Fields("Notes") = txtNotes.Text 
            rs.Fields("Recorder") = txtRecorder.Text 
            rs.Fields("Date") = txtDate.Text 
            rs.Fields("Group") = txtGroup.Text 
            rs.Fields("keeper") = txtkeeper.Text 
            rs.Update 
            rs.Close 
            MsgBox "ok!", , "manage" 
     
            Adodc1.RecordSource = "select * from INFO  order by ID"
            Adodc1.Refresh这样就只能指向第一条记录了
      

  3.   

        '设置update语句:如
        sqlstmt = "update businessman set businessmanid='" + Trim(businessmanid) + "',businessmanname='" + Trim(businessmanname) + "',country='" + Trim(country) + "',province='" + Trim(province) + "',city='" + Trim(city) + "',address='" + Trim(address) _
                  + "', linkman='" + Trim(linkman) + "',telephone='" + Trim(telephone) + "',fax='" + Trim(fax) + "' where businessmanid='" + Trim(oribusinessmanid) + "'"
      

  4.   

    两次查询,同一条纪录的Book是不能保证一致的。
    你应该用其它的逻辑主键去查找(RecordSet.Find)定位。