Dim cnn As New ADODB.Connection
Dim rs As New ADODB.Recordset
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
cnn.CursorLocation = adUseClient
cnn.connectionstring = connstr
cnn.Open
rs.Open "SELECT * FROM 表1 where 准考证号='" & Text1.Text & "' ", cnn
With rs
.Fields("准考证号") = Text1.Text
.Fields("A") = Text4.Text
.Fields("B") = Text5.Text
.Fields("C") = Text6.Text
.Update
End With
rs.Update
rs.movenext
text1.text=rs.Fields("准考证号")
End If
cnn.Close
我的意思是当我一条数据修改完后,指针自动移动到下一条,并且把下一条的“准考证号”赋给text1 可是老出错,请高手指教,谢谢 急。
Dim rs As New ADODB.Recordset
rs.LockType = adLockOptimistic
rs.CursorType = adOpenKeyset
cnn.CursorLocation = adUseClient
cnn.connectionstring = connstr
cnn.Open
rs.Open "SELECT * FROM 表1 where 准考证号='" & Text1.Text & "' ", cnn
With rs
.Fields("准考证号") = Text1.Text
.Fields("A") = Text4.Text
.Fields("B") = Text5.Text
.Fields("C") = Text6.Text
.Update
End With
rs.Update
rs.movenext
text1.text=rs.Fields("准考证号")
End If
cnn.Close
我的意思是当我一条数据修改完后,指针自动移动到下一条,并且把下一条的“准考证号”赋给text1 可是老出错,请高手指教,谢谢 急。
你 movenext 往哪走啊?请不要把 rs 和基础表理解为同一样东西。改成 rs.Open "SELECT * FROM 表1 ", cnn 吧。