Dim isAdding As Boolean
Dim RSR As New ADODB. You
Public Sub InitRecordSet ()
If (RSR. State=1) Then
RSR. Close
End the If
RSR. Open the "select * from [injection sales order]", conn, 3, 2
The Set DataGrid1. The DataSource=RSR
End Sub
The Set DataGrid1. The DataSource=RSR
7004/presenting bank collection not a tag
CodePudding user response:
The problem of the connection stringRSR. Open the "select * from [injection sales order]", conn, 3, 2 to the following:
RSR. CursorLocation=adUseClient
RSR. Open the "select * from [injection sales order]", conn, adOpenDynamic adLockOptimistic,
CodePudding user response:
Add a primary key to database tables, the reason for the error of offline data there is no primary key ADO don't know how it and database records,Your database for example, two the same data, then you modify one, on the client to update again, ADO which is know you modify?
http://blog.csdn.net/cly2004/article/details/333304
CodePudding user response:
The top...The easiest way to be: change for: RSR. Open the "select * from [injection sales order]", conn., adOpenStatic adLockOptimistic
CodePudding user response:
Should be binding activities of the record set of connection objects conn, require the use of dynamic cursor (2), and the original poster is a static cursor (3),When there is no connection object, the following code can be run:
'Create a you
Dim RST As ADODB. You
Private Sub Command1_Click ()
The Set RST=New ADODB. You
'Add columns to the you
RST. Fields. Append "Key", adInteger
RST. Fields. Append "Field1, adVarChar, 40, adFldIsNullable
RST. Fields. Append "Field2 adDate
'Open the you
RST. Open, 2, 3,
'Add data to the you
RST. AddNew Array (" Key ", "Field1", "Field2), _
Array (1, "string1", Date)
RST. AddNew Array (" Key ", "Field1", "Field2), _
Array (2, "string2", # # 1/1/2000)
'the Populate the Data in the DataGrid
Set DataGrid1. The DataSource=RST
End Sub
Private Sub Command2_Click ()
'the Modify the data through code
RST. MoveFirst
RST (1)="Changed the Field"
RST. UpdateBatch
End Sub
Private Sub Form_Load ()
Command1. Caption="Populate"
Command2. Caption="Update"
End Sub