PRB: STINYINT Data Type Not Supported in Access Driver

ID: Q131382

2.00.2317 WINDOWS kbother kberrmsg kbcode

The information in this article applies to:

BUG# QJet: 1666 (2.00.2317)

SYMPTOMS

The Microsoft Access driver version 2.00.2317 returns the following error when a parameter is bound from SQL_C_STINYINT to any SQL data type:

   Invalid string or buffer length

When the parameter markers are used to insert or update rows and a call to SQLBindParameter binds a SQL_C_STINYINT to any SQL data type, the insert or update fails. SQL_C_STINYINT is an extended C data type that corresponds to a 'Signed Char' C type. The ODBC version 2.0 "Programmer's Reference" states that SQL_C_STINYINT is converted to SQL_TINYINT by default and a host of other conversions are supported.

CAUSE

The problem arises because the Jet engine does not support a 'Signed TinyInt' data type. Jet is Microsoft's database engine on which the Access driver relies for its data processing. However, the driver returns the above error when it should return the error:

   Driver not capable

WORKAROUND

The workaround is to use a SQL_C_SHORT or some other data type instead of a SQL_C_STINYINT.

STATUS

Microsoft has confirmed this to be a problem in 16- and 32-bit ODBC Access driver version 2.00.2317. We are researching this problem and will post additional information here in Microsoft Knowledge Base as it becomes available.

MORE INFORMATION

The following code would produce the error:

SQLExecDirect(hstmt1,"create table oof (col1 integer)",SQL_NTS) SQLBindParameter(hstmt1,1,SQL_PARAM_INPUT,SQL_C_STINYINT,SQL_INTEGER,0,0,5, 0, 0) SQLExecDirect(hstmt1,"insert into oof values(?)",SQL_NTS)

The last call would return a SQL state S1090, native error 62, and the following message when a SQL_SUCCESS is expected:

   Invalid string or buffer length

Additional reference words: 2.002317 ODBC Access MFC Database Classes Windows NT WFW 3.11 Windows 3.10 KBCategory: kbother kberrmsg kbcode KBSubcategory:
Version           : 2.00.2317
Platform          : WINDOWS

Last Reviewed: March 17, 1999