[Qt-interest] MSSQL Mac query
Wolfgang Kriener
wkriener at fms-computer.de
Mon Jul 27 11:49:48 CEST 2009
Am 24.07.2009 um 16:43 schrieb Stephen Jackson:
> On Fri, Jul 24, 2009 at 3:21 PM, Wolfgang Kriener wrote:
>>
>> Am 24.07.2009 um 15:46 schrieb Nehemiah Dacres:
>>
>>> perhaps you should give us more context
>>
>> thank you for being interested.
>>
>> i use Mac OS 10.5.7, QT 4.5.2, Actual ODBC driver v. 2.9b
>>
>> i built plugin-sql-odbc using Macs builtin iodbc library and builtin
>> headers
>>
>> here is what i did:
>>
>> ...
>> db = QSqlDatabase::addDatabase("QODBC");
>> QString s = "DRIVER={Actual SQL
>> Server};SERVER=myServerIP;UID=myUser;PWD=myWord;DATABASE=myDatabase";
>> db.setDatabaseName( s );
>> db.setConnectOptions("SQL_ATTR_ODBC_VERSION=SQL_OV_ODBC3");
>> if (db.open()) {
>> model = new QSqlTableModel(this, db);
>> model->setTable("TestTable");
>> model->setHeaderData(0, Qt::Horizontal, tr("I3D"));
>> ... some other headers
>>
>> bool myBool = model->select();
>> QString myError = model->lastError().text();
>> }
>> ...
>>
>
> What does model->query().lastQuery() give you? This should help to see
> what's going on.
model->query().lastQuery() gives back a regular SQL Select statement.
In the drivers odbc logfile the only line that reports an SQL_ERROR
comes from an open SELECT Statement. all other executes end with
SQL_SUCCESS
i don't know how 'select "| ' satement is formed.
Any ideas?
#####
Gutscheine A02AF720 ENTER SQLExecDirect
SQLHSTMT 0x5f71e0
SQLCHAR * 0x5f7d70
| SELECT "I |
SQLINTEGER 174
[000000.203849]
Gutscheine A02AF720 EXIT SQLExecDirect with return code -1
(SQL_ERROR)
SQLHSTMT 0x5f71e0
SQLCHAR * 0x5f7d70
SQLINTEGER 174
[000000.203987]
Gutscheine A02AF720 ENTER SQLGetDiagRec
SQLSMALLINT 3 (SQL_HANDLE_STMT)
SQLHSTMT 0x5f71e0
SQLSMALLINT 1
SQLCHAR * 0xbffff5ba
SQLINTEGER * 0xbffff5c4
SQLCHAR * 0xbffff3ba
SQLSMALLINT 512
SQLSMALLINT * 0xbffff5ce
[000000.204139]
Gutscheine A02AF720 EXIT SQLGetDiagRec with return code 0
(SQL_SUCCESS)
SQLSMALLINT 3 (SQL_HANDLE_STMT)
SQLHSTMT 0x5f71e0
SQLSMALLINT 1
SQLCHAR * 0xbffff5ba
| 42000 |
SQLINTEGER * 0xbffff5c4 (105)
SQLCHAR * 0xbffff3ba
| [Actual][SQL Server] Unclosed quotation |
| mark after the character string 'I'. |
SQLSMALLINT 512
SQLSMALLINT * 0xbffff5ce (76)
#######
> Regards,
>
> Stephen Jackson
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
More information about the Qt-interest-old
mailing list