ODBC recordset.edit

ODBC recordset.edit

Post by Da » Thu, 23 Jul 1998 04:00:00



Does anyone know how to do an edit on a ODBC connection,

here's my code so far, it doesn't give any errors but it doesn't
update the database either!

Private Sub Command1_Click()
    Dim wrkspace As Workspace
    Dim dbsSnap As Connection
    Dim rstTemp As Recordset
    Dim idxKey As Index
    Dim tdfNew As TableDef

    DefaultType = dbUseODBC
    Set wrkspace = DBEngine(0)

    wrkspace.DefaultCursorDriver = dbUseClientBatchCursor

    Set wrkspace = CreateWorkspace("ODBCWorkspace", "admin", "",
dbUseODBC)

    wrkspace.DefaultCursorDriver = dbUseClientBatchCursor

    Set dbsSnap = wrkspace.OpenConnection("snapDB", _
        dbDriverCompleteRequired, False, _
        "ODBC;DATABASE=snapDB;UID=;PWD=;DSN=snap")

    'Set rstTemp = dbsSnap.OpenRecordset( _
        '"SELECT * FROM info", dbOpenDynamic)

    Set rstTemp = dbsSnap.OpenRecordset("select * from info", _
        dbOpenDynaset, 0, dbOptimisticBatch)

    MsgBox (rstTemp.Updatable)

    rstTemp.MoveLast
    MsgBox (rstTemp.RecordCount)
    rstTemp.MoveFirst

    rstTemp.Edit
    'rstTemp("output1") = "999999"
    rstTemp!output1 = "1111"
    rstTemp.Update 'should write to the db here

    rstTemp.Close
    dbsSnap.Close
    wrkspace.Close

End Sub

my DB has an index on the unique primary key field, does something
have to be done in VB too?

Thanks a Bundle!
Dan

 
 
 

1. ODBC recordset.edit

Does anyone know how to do an edit on a ODBC connection,

here's my code so far, it doesn't give any errors but it doesn't
update the database either!

Private Sub Command1_Click()
    Dim wrkspace As Workspace
    Dim dbsSnap As Connection
    Dim rstTemp As Recordset
    Dim idxKey As Index
    Dim tdfNew As TableDef

    DefaultType = dbUseODBC
    Set wrkspace = DBEngine(0)

    wrkspace.DefaultCursorDriver = dbUseClientBatchCursor

    Set wrkspace = CreateWorkspace("ODBCWorkspace", "admin", "",
dbUseODBC)

    wrkspace.DefaultCursorDriver = dbUseClientBatchCursor

    Set dbsSnap = wrkspace.OpenConnection("snapDB", _
        dbDriverCompleteRequired, False, _
        "ODBC;DATABASE=snapDB;UID=;PWD=;DSN=snap")

    'Set rstTemp = dbsSnap.OpenRecordset( _
        '"SELECT * FROM info", dbOpenDynamic)

    Set rstTemp = dbsSnap.OpenRecordset("select * from info", _
        dbOpenDynaset, 0, dbOptimisticBatch)

    MsgBox (rstTemp.Updatable)

    rstTemp.MoveLast
    MsgBox (rstTemp.RecordCount)
    rstTemp.MoveFirst

    rstTemp.Edit
    'rstTemp("output1") = "999999"
    rstTemp!output1 = "1111"
    rstTemp.Update 'should write to the db here

    rstTemp.Close
    dbsSnap.Close
    wrkspace.Close

End Sub

my DB has an index on the unique primary key field, does something
have to be done in VB too?

Thanks a Bundle!
Dan

2. How to sync. sequence number and SQL*Loader input?

3. HLP : Access VB5 with ODBC cannot .Edit a recordset (.updatable = False)

4. Replication Failure

5. Unable to edit snapshot recordset

6. error 9004

7. Help:Editing field values of an ADO recordset returned from SQL SP

8. OBDC and REF CURSOR

9. RecordSet Edit Method

10. Help: Editing field values of ADO recordset from SQL db

11. Editing/Updating 'Constant' Field In Recordset

12. recordset.Edit() Locking vs. Stale Data