PDA

View Full Version : Frustrated with ODBC



darkadept
1st April 2008, 15:44
I'm trying to develop an app for Windows using the QODBC driver to connect to Microsoft SQL Server. I'm using mingw to compile. I am doing a lot of my actual development under Linux with Mysql but then I want to port my application to run on windows.

I'm using basic Qt classes to connect to the database, QSqlTableModel, QSqlQuery, QTableView, and QDataWidgetMapper. I'm doing nothing fancy and it works perfectly with Mysql.

But it seems like only a small subset of classes that actually work with ODBC. I initially tried to use QSqlQuery using the bind values method and that fails.
Using table views and table models seem to work but now that I'm trying to use QDataWidgetMapper I get a ton of errors about being "unable to bind variable".

[edit] The actual error i'm getting (when QDataWidgetMapper tries to save the data to the database is:
QODBCResult::exec: unable to bind variable: [Microsoft][ODBC SQL Server Driver]Optional feature not implemented

Is anyone actually using Microsoft Sql Server via ODBC on Windows with any success?

darkadept
1st April 2008, 16:03
Ok... at least i finally found some direction now.

I turned on ODBC tracing and found this error:


mydb 62c-630 EXIT SQLBindParameter with return code -1 (SQL_ERROR)
HSTMT 05223A20
UWORD 8
SWORD 1 <SQL_PARAM_INPUT>
SWORD 9 <SQL_C_DATE>
SWORD 9 <SQL_DATE>
SQLULEN 0
SWORD 0
PTR 0x06394428
SQLLEN 0
SQLLEN * 0x00000000

DIAG [S1C00] [Microsoft][ODBC SQL Server Driver]Optional feature not implemented (0)


This led me to this thread:
http://www.mydatabasesupport.com/forums/sqlserver-odbc/184663-hyc00-optional-feature-not-implemented.html
where it talks about specific date values not being able to bind. Specifically DATE and TIME. DATETIME should work though, I think.

Does anyone have any further input on how to correct this or work around this error?

AlphaWolfXV
8th December 2011, 02:23
I am curious if this has ever been resolved? I am running into exactly the same issue and not really finding any help...
Thanks,
AlphaWolfXV

ChrisW67
8th December 2011, 03:31
If your code tries to do things with SQL or data types that are not supported by the underlying RDBMS or ODBC driver, neither of which is part of Qt, then you can expect it to fail. Darkadept implies that the issue was with data types. Since neither of you have told us exactly what you are doing there is little help to be offered.