Cannot make AddNew method work properly. 
Author Message
 Cannot make AddNew method work properly.

I'm using VB6 with SQL 6.5 . When I run the AddNew method the recordset
fields seem to update but not the recordcount or underlying database.

The code looks like this.

    Dim FieldList(5)
    Dim ValueList(5)

    Set cnn1 = New ADODB.Connection
    strCnn = "UserID=sa;Password=;DSN=SSITimeSheet;"
    cnn1.Open strCnn

    Set rs = New ADODB.Recordset
    sSQL = "SELECT ManagementName FROM tblManagement"

    rs.CursorType = adOpenKeyset
    rs.LockType = adLockOptimistic
    rs.Open sSQL, cnn1, , , adCmdText
    FieldList(0) = "DeveloperID"
    FieldList(1) = "ProjectID"
    FieldList(2) = "TaskID"
    FieldList(3) = "tsDate"
    FieldList(4) = "tsTime"
    FieldList(5) = "Notes"

    'Set the field values
    ValueList(0) = DeveloperID
    ValueList(1) = ProjectID
    ValueList(2) = TaskID
    ValueList(3) = TaskDate
    ValueList(4) = TaskTime
    ValueList(5) = Note
    rs.AddNew FieldList2, ValueList2
    'Update the database
    rs.Update

I have tried this and several other methods, non of which seem to work.

Your help will be greatly appreciated.

Lee Timms



Fri, 13 Apr 2001 03:00:00 GMT  
 Cannot make AddNew method work properly.
You need to use the UpdateBatch()  method when opening the recodset with
adLockOptimistic.
Update() only "commits" to the recordset, not  the underlying database.

There is good info on this in the MDAC 2.0 documentation supplied with the
resource kit.
You can download this from msdn.microsoft.com/data



Fri, 13 Apr 2001 03:00:00 GMT  
 Cannot make AddNew method work properly.

Quote:
>You need to use the UpdateBatch()  method when opening the recodset with
>adLockOptimistic.
>Update() only "commits" to the recordset, not  the underlying database.

AIUI, UpdateBatch() is only necessary with lock type adLockBatchOptimistic


Sun, 15 Apr 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Cannot make AddNew method work properly.

2. Data Refresh Cannot Worked Properly.

3. Cannot get joins working properly in subreport

4. Update method in VB6 not working properly

5. Select method doesn't work properly

6. Update method in VB6 not working properly

7. AddNew method does not work

8. .addnew method ADO does not work pls help

9. AddNew Method not working for me anymore.

10. AddNew method doesn't work right!!

11. AddNew/REquery method of ADO Recordset not Working?

12. Addnew and update method in ADOCE not working ?

 

 
Powered by phpBB® Forum Software