Subscribe to AfterDawn's weekly newsletter.
can u tell me code in vb6.0 for addnew item in table by adodc there is no primary key ,there is candidate key
Asked by: Anonymous User,
Answers
With table that has 3 columns.
1st column is "ID"
2nd is "FirstName"
3rd is "LastName"
Dim rs As ADODB.Recordset
Set rs = New ADODB.Recordset
rs.Open "TableName", CurrentProject.Connection, adOpenKeyset, adLockOptimistic
rs.AddNew
rs(0)= 100 dont add this line if ID is auto number
rs(1)= "John"
rs(2)= "Doe"
rs.Update
rs.close
-Thats all there is to it.
-Make sure you reference ADO (Microsoft ActiveX Data Objects 6.0 Library)
-Your version may be 5.0 or something else.

