Is there any way to get no of records updated/deleted when using CCommand.Open method (DBROWCOUNT)?
Eg, Oracle OLEDB provider always returns no of records, for SELECT, UPDATE, DELETE, etc.
CCommand<CNoAccessor, CNoRowset> cmd;
DBROWCOUNT* pRowsAffected;
. . .
cmd.Execute(. . ., pRowsAffected, . . .);
#include <atldbcli.h>
CDataSource dataSource;
CSession session;
HRESULT hr = dataSource.OpenFromInitializationString(CONN_STR);
hr = session.Open(dataSource);
// Start transaction
hr = session.StartTransaction();
// update a record in contact table
CCommand<CNoAccessor, CNoRowset> cmd;
DBROWCOUNT rowsAffected;
hr = cmd.Open(session, "UPDATE contact SET fname='test' WHERE contact_id=1", NULL, &rowsAffected, DBGUID_DBSQL, false);
cmd.Close();
// delete records
hr = cmd.Open(session, "DELETE FROM contact WHERE contact_id<>1", NULL, &rowsAffected, DBGUID_DBSQL, false);
cmd.Close();
// Rollback transaction
session.Abort();
Users browsing this forum: No registered users and 1 guest