Reputation: 62836
My C++ app needs to deal with SSCE database files belonging to different versions. Right now, I have no way of knowing the version of the database.
The problem is that if the version of the OLEDB SSCE provider mismatches the version of the database file, IDBInitialize::Initialize()
fails with E_FAIL
. One has to obtain the respesctive IErrorInfo
object to get a meaningful error message.
The point is that the error code of E_FAIL
does not tell me whether the failure is because of the version mismatch or for some other reason. In the first case, I should retry with another SSCE provider, while in the second the application should terminate.
How can I implement this logic? Is there some API that I can invoke before calling IDBInitialize::Initialize()
to check the version compatibility? Is there a way to get the real error code instead of the opaque E_FAIL
?
Thanks.
Upvotes: 0
Views: 1371
Reputation: 41799
You can look at the first bytes of the file - see this sample in C# - http://erikej.blogspot.com/2010/08/how-to-upgrade-version-3x-database-file.html
Upvotes: 1