vb数据修改
Setcn1=NewADODB.Connectioncn1.ConnectionString="provider=microsoft.jet.oledb.4.0;data...
Set cn1 = New ADODB.Connection
cn1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\book.mdb"
cn1.Open
Set rs1 = New ADODB.Recordset
Set rs1.ActiveConnection = cn
rs1.CursorLocation = adUseClient
rs1.CursorType = adOpenDynamic
rs1.LockType = adLockOptimistic
sql1 = "select * from 图书信息 where 图书编号='" & Trim(Text2) & "' "
rs1.Open sql
If rs1.EOF Then
MsgBox "没有你所输入的图书编号!请重新输入!"
Text2 = ""
Text2.SetFocus
Exit Sub
Else
rs.edit
rs!借出情况 = "已借出"
rs!借阅人 = Trim(Text1)
rs.Update
End If
但是rs 没有edit 这个 修改的方法,请问这个地方该怎么办勒? 展开
cn1.ConnectionString = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\book.mdb"
cn1.Open
Set rs1 = New ADODB.Recordset
Set rs1.ActiveConnection = cn
rs1.CursorLocation = adUseClient
rs1.CursorType = adOpenDynamic
rs1.LockType = adLockOptimistic
sql1 = "select * from 图书信息 where 图书编号='" & Trim(Text2) & "' "
rs1.Open sql
If rs1.EOF Then
MsgBox "没有你所输入的图书编号!请重新输入!"
Text2 = ""
Text2.SetFocus
Exit Sub
Else
rs.edit
rs!借出情况 = "已借出"
rs!借阅人 = Trim(Text1)
rs.Update
End If
但是rs 没有edit 这个 修改的方法,请问这个地方该怎么办勒? 展开
2个回答
展开全部
不用写rs.edit的,直接可以修改。看看我的一个例子:MDB中取唯一ID号。
Public Function Get_No() As Long
Dim aDB As New ADODB.Connection
Dim aR As New Recordset
Dim n As Long
aDB.Open CnnStr
aR.Open "yyno", aDB, adOpenDynamic, adLockOptimistic
aR.MoveFirst
n = aR!currno
aR!currno = n + 1
aR.Update
aR.Close
Set aR = Nothing
aDB.Close
Set aDB = Nothing
Get_No = n
End Function
Public Function Get_No() As Long
Dim aDB As New ADODB.Connection
Dim aR As New Recordset
Dim n As Long
aDB.Open CnnStr
aR.Open "yyno", aDB, adOpenDynamic, adLockOptimistic
aR.MoveFirst
n = aR!currno
aR!currno = n + 1
aR.Update
aR.Close
Set aR = Nothing
aDB.Close
Set aDB = Nothing
Get_No = n
End Function
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询