How do I use an RWDBCursor for Write?

Article ID: 864
Last updated: 05 Feb, 2008
Article ID: 864
Last updated: 05 Feb, 2008
Revision: 1
Views: 2558
Posted: 10 Sep, 1997
by Dean J.
Updated: 05 Feb, 2008
by Dean J.
Problem


When I try to use an RWDBCursor for Write (update), I am unable to write to the table.


Cause


With DBTools 3.x and above versions, you have to put the writable cursor in a transaction mode.

With Sybase and MSSQL Server, you might see an error saying that the table doesn't have an unique index.

Both Sybase and MSSQL Server does need an unique index on every table involved in every cursor operation.



Action


Here is an example:

conn.beginTransaction();
RWDBCursor csr = select.cursor(.., conn, RWDBCursor::Write);
int bd;
csr>>&bd;
while(csr.fetchRow().isValid())
{
....
csr.updateRow(...);
}
conn.CommitTransaction();

For Sybase and MSSQL Server, create a unique index on the table before attempting to create an RWDBCursor for Write.
See your database vendor's documentation for information on how to do this.
This article was:   Helpful | Not helpful
Report an issue
Article ID: 864
Last updated: 05 Feb, 2008
Revision: 1
Views: 2558
Posted: 10 Sep, 1997 by Dean J.
Updated: 05 Feb, 2008 by Dean J.

Others in this category