首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VB >

求救:VB循环ACCESS字段,并赋值,该怎么处理

2012-01-14 
求救:VB循环ACCESS字段,并赋值,,,rsr.Open select * from sky_user, Conn2, 1, 3Do While Not rsr.EOFrs

求救: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

这样不行哦,,
怎么解决呢?

[解决办法]

VB code
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加入
VB code
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 

热点排行