Are things like -2146824535, 0x800A0EA9, Unknown error, Provider is not specified and there is no designated default provider (while it is there and apparently well specified) and similar wasting your day, even do the connection seems to open perfectly on x86 and amazingly even on some x64 code, but not in some other?
Give a look at the exact format of the connection string. Give it an hard look.
In my case, the x86 format was as such:
connectionString = _bstr_t("\
Provider=sqloledb; \
Data Source=") + server + _bstr_t(";\
Initial Catalog=") + database + _bstr_t(";");
This was not working at all in x64, returning all the above. Changing it in the following, made it working both for x64 and x86:
connectionString = _bstr_t("Provider=sqloledb; \
Data Source=") + server + _bstr_t(";\
Initial Catalog=") + database + _bstr_t(";");
The difference was basically 6 blank spaces, if you don't count the starting escape.
Amazing, isn't?
No comments:
Post a Comment