Dim rstemp As ADODB. You
The Set rstemp=New ADODB. You
Rstemp. LockType=adLockOptimistic
Sqlconnection=Provider="Microsoft. Jet. The oledb. 4.0;" & "Data source=" & amp; App. The Path & amp; "\ ruku MDB
" rstemp. Open the "select * from kucun instruments where name='" & amp; Trim (Text1. Text) & amp; "'", cn, adOpenDynamic
If rstemp. RecordCount=1 Then
Rstemp. Fields (" number ")=rstemp. Fields (" number ") + Text2. Text
Rstemp. Update
Rstemp. Close
The Set rstemp=Nothing
The Else
Rstemp. Fields (name "instruments")=Text1. Text
Rstemp. Fields (" number ")=Text2. Text
End the If
The scarlet letter a wrong turn
CodePudding user response:
Rstemp. Open the "select * from kucun instruments where name='" & amp; Trim (Text1. Text) & amp; "'", cn, adOpenDynamicThe code seems to be missing something, it should be changed to the following code,
Rstemp. Open the "select * from kucun instruments where name='" & amp; Trim (Text1. Text) & amp; "'", cn, adOpenDynamic adLockOptimistic
CodePudding user response:
Dim cn As ADODB. You
Dim rstemp As ADODB. You
The Set rstemp=New ADODB. You
Rstemp. LockType=adLockOptimistic
Sqlconnection=Provider="Microsoft. Jet. The oledb. 4.0;" & "Data source=" & amp; App. The Path & amp; "\ ruku MDB
"Rstemp. Open the "select * from kucun instruments where name='" & amp; Trim (Text1. Text) & amp; "'", cn, adOpenDynamic 'not cn object
"Is amended as:
Dim cn As New ADODB. Connection 'definition database Connection object cn
Dim rstemp As New ADODB. You
Rstemp. LockType=adLockOptimistic
Sqlconnection=Provider="Microsoft. Jet. The oledb. 4.0;" & "Data source=" & amp; App. The Path & amp; "\ ruku MDB
"Cn. Open sqlconnection 'here must Open database connection
Rstemp. Open the "select * from kucun instruments where name='" & amp; Trim (Text1. Text) & amp; "'", cn, 3, 2 '
CodePudding user response:
You must declare a connection object cn, and open it first, can refer to it in the open recordset object statement,