I'm pretty new to SDAC and trying to move some old ADO code to SDAC. While doing this, I noticed that ADO performed faster when doing inserts in the db.
This is the old ADO code:
Code: Select all
_ConnectionPtr pConn( "ADODB.Connection" );
pConn->Open( connectString, "", "", 0 );
_RecordsetPtr pRs;
HRESULT hr = pRs.CreateInstance(__uuidof(Recordset));
pRs->Open( "select * from MyTable", pConn.GetInterfacePtr() , adOpenForwardOnly, adLockOptimistic, adCmdUnknown) ;
for (int i = 0; i < 100; i++)
{
hr = pRs->AddNew();
// here we set the record fields
getRecord(pRs);
pRs->Update();
}
pRs->Close();Code: Select all
TMSConnection connection = new TMSConnection(NULL);
connection->ConnectString = connectString;
connection->Connected = true;
TMSQuery* query = new TMSQuery(NULL);
query->Connection = connection;
query->SQL->Text = "select * from MyTable";
query->Open();
for (int i = 0; i < 100; i++) {
{
query->Append();
WriteToDb(query, wstrl.at(i).c_str(), "ASVResult");
query->Post();
}
query->Free();Any ideas what might be the reason for this?
thanks,
Matt