求救:VB循环ACCESS字段,并赋值,,,
rsr.Open "select * from sky_user", Conn2, 1, 3
Do While Not rsr.EOF
rsr("CK") = "?"
rsr.MoveNext
Loop
rsr.Update
rsr.Close
这样不行哦,,
怎么解决呢?
[解决办法]
Set Connr = New Connection mystr = App.Path If Right(mystr, 1) <> "\" Then mystr = mystr & "\" Connr.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & [color=#FF0000]mystr[/color] & "admin.mdb;Persist Security Info=False;Jet OLEDB:Database Password=gp8586" Connr.Open Set rsr = New Recordset If rsr.State <> adStateClosed Then rsr.Close rsr.Open "select * from sky_user", Connr, adOpenKeyset, adLockOptimistic, adCmdTextDo While Not rsr.EOF rsr("CK") = "?" rsr.Update rsr.MoveNext Loop rsr.Close
[解决办法]
注意mystr加入
Set Connr = New Connection mystr = App.Path If Right(mystr, 1) <> "\" Then mystr = mystr & "\" Connr.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & mystr & "admin.mdb;Persist Security Info=False;Jet OLEDB:Database Password=gp8586" Connr.Open Set rsr = New Recordset If rsr.State <> adStateClosed Then rsr.Close rsr.Open "select * from sky_user", Connr, adOpenKeyset, adLockOptimistic, adCmdTextDo While Not rsr.EOF rsr("CK") = "?" rsr.Update rsr.MoveNext Loop rsr.Close