I have a SQLCompact database that I'm trying to access using ADO
and C++
. However due to the size of the database (300MB, over the default 256MB limit), I have to specify the Max Database Size
in the connection string. However doing so causes the .Open(...)
function to throw.
The code I'm using:
HRESULT hr = conn.CreateInstance(__uuidof(Connection), NULL);
conn->Open(L"Provider=Microsoft.SQLSERVER.CE.OLEDB.4.0;Data Source=test.sdf;Max Database Size=512", L"", L"",adConnectUnspecified);
The error:
HR: DB_E_ERRORSOCCURRED
Description: "Multiple-step OLE DB operation generated errors. Check each OLE DB status value, if available. No work was done."
Message: "IDispatch error #3105"
Note:
I've tried using the same code, with a smaller database and removing Max Database Size
from the connection string and it works as expected. Adding the Max Database Size
again causes the problem to reappear, therefore my assumption that it's the one causing the error.
Any thoughts? How can I work with databases over the Provider
default size?
You must use:
Provider= Microsoft.SQLSERVER.CE.OLEDB.4.0;Data Source=test.sdf;ssce:Max Database Size=512
(same applies to password and other SQL Compact specific keywords)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With