H
Hovhannes Asatryan
Hi guys.
I wrote a program that inserts 100000 rows to the db.
I have an ACCESS and SQL SERVER databases
when I connect to access the duration of inserting is ~17 seconds, but when
run it for the SQL it takes ~3 minutes.
I am connecting by ADO driver in both case
rSet is the _RecordtSetptr pointer.
Can anyone tell me what is wrong or may be everything is ok?
long starttime = GetTickCount();
for(int i = 0; i < 100000; i++)
{
COleDateTime time = COleDateTime::GetCurrentTime();
rSet->AddNew();
rSet->PutCollect("ProductID", i);
rSet->PutCollect("ProductName", "name");
rSet->PutCollect("CreatedDate", time);
rSet->PutCollectUnitPrice", 100 + i);
rSet->Update();
}
str.Format("%ld", GetTickCount() - starttime);
AfxMessageBox((LPCTSTR)str);
long starttime = GetTickCount();
for(int i = 0; i < 100000; i++)
{
rSet.Execute("Insert into Product11 (ProductID, ProductName,
CreatedDate, Price) values (1, \'name\', 3, 100)");
}
str.Format("%ld", GetTickCount() - starttime);
AfxMessageBox((LPCTSTR)str);
I wrote a program that inserts 100000 rows to the db.
I have an ACCESS and SQL SERVER databases
when I connect to access the duration of inserting is ~17 seconds, but when
run it for the SQL it takes ~3 minutes.
I am connecting by ADO driver in both case
rSet is the _RecordtSetptr pointer.
Can anyone tell me what is wrong or may be everything is ok?
long starttime = GetTickCount();
for(int i = 0; i < 100000; i++)
{
COleDateTime time = COleDateTime::GetCurrentTime();
rSet->AddNew();
rSet->PutCollect("ProductID", i);
rSet->PutCollect("ProductName", "name");
rSet->PutCollect("CreatedDate", time);
rSet->PutCollectUnitPrice", 100 + i);
rSet->Update();
}
str.Format("%ld", GetTickCount() - starttime);
AfxMessageBox((LPCTSTR)str);
long starttime = GetTickCount();
for(int i = 0; i < 100000; i++)
{
rSet.Execute("Insert into Product11 (ProductID, ProductName,
CreatedDate, Price) values (1, \'name\', 3, 100)");
}
str.Format("%ld", GetTickCount() - starttime);
AfxMessageBox((LPCTSTR)str);