"SQL data type out of range" error on SQL_TYPE_DATE (1 Viewer)

daihard

New member
Local time
Today, 06:03
Joined
Dec 2, 2011
Messages
1
Hi.

I am a software engineer developing the ODBC driver for our database product. One of the tools we test it with is Microsoft Access 2010, and I am having an issue here. Hopefully someone can enlighten me on this.

Here's what happens. I can use Access 2010 to create a linked table using our driver. The table rows are displayed correctly. However, if one or more columns are of DATE/TIME/TIMESTAMP type, inserting a new row fails with an "SQL data type out of range" error. The SQLSTATE is S10004.

I enabled logging to see what was going on. As it turned out, Microsoft ODBC Driver Manager returned that error on the following function.

SQLBindParameter(hStmt, 3, SQL_PARAM_INPUT, SQL_C_WCHAR,
SQL_TYPE_DATE, 10, 0, buffer, 0, &cb3);

What seems to be causing the problem is the fact that Access 2010 makes ODBC 2 function calls to connect to our driver. For instance, it uses SQLAllocEnv() and SQLAllocConnect(), instead of SQLAllocHandle(), to create handles. Since SQL_TYPE_DATE is a new data type introduced with ODBC 3, SQLBindParameter() considers it invalid for ODBC 2, thereby returning an error.

My question is, how can I get around it? The log file suggests that Access does not make a call to SQLGetTypeInfo() to obtain the types we support, so there's not much I can do there. The only other thing I could think of is to somehow force Access to make ODBC 3 calls, but how?

Any help would be much appreciated!

Dai
 

Users who are viewing this thread

Top Bottom