alangab
alangab

Reputation: 867

Comparing performance of OLEDB and Ado.Net

I'm trying to get similar performance to Ado.Net with OLEDB but without success. The best I can get is 50% slower than Ado.Net so I think i'm doing something wrong. I need a forward only reading of recordset, no need to update.

    ADODB::_ConnectionPtr con;
    con.CreateInstance(__uuidof(ADODB::Connection) );
    con->ConnectionString = "...";
    con->Open("", "", "", ADODB::adConnectUnspecified);

    ADODB::_RecordsetPtr rs;
    rs.CreateInstance(__uuidof(ADODB::Recordset) );

    rs->Open(bstr_t("select * FROM BigTable"), _variant_t((IDispatch *)con), ADODB::adOpenForwardOnly, ADODB::adLockReadOnly, ADODB::adAsyncFetch);

    rs->MoveFirst();
    int count=0;

    while (! rs->EndOfFile)
    {
        ++count;
        rs->MoveNext();

    }

    rs->Close();

I'm using Native Client OLEDB provider. Is there other option (excluding .net) to read data in faster way?

Upvotes: 1

Views: 879

Answers (1)

Related Questions