I have to read data from mdb-files using c++ but I’m having trouble getting started. I found this tutorial, but my code always crashes when I try to connect to a local database file.
ADO::_ConnectionPtr conn;
conn.CreateInstance( __uuidof( ADO::Connection ) );
conn->Open( L"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\database.mdb;",
L"",
L"password",
ADO::adConnectUnspecified);
Is there anything wrong with the code above?
If you add some error handling, it won’t crash. and you’ll have a chance of diagnosing what’s going wrong: