filya
1st December 2006, 22:23
I have a strange problem with QT handling stored procedures.
I’m trying to execute stored procedure on MS SQL using ODBC and QT
Assume that I already established connection to the database.
QSqlQueryModel model;
model.setQuery("{CALL test_proc}", m_Database );
if test_proc procedure is defined like
CREATE PROCEDURE TEST_PROC
AS
SELECT TOP 10 TITLE_ID, TITLE FROM TITLES
Everything is OK. The model receives data and I can display it in the table.
If test_proc procedure is defined like
CREATE PROCEDURE TEST_PROC
AS
SELECT TOP 10 TITLE_ID, TITLE FROM TITLES
RETURN 0
The model thinks that there is no data to receive and shows me that record set is empty.
I have tried to use the same procedures without using model but result was the same.
No matter if model is used or QSqlQuery as soon as I add RETURN 0 or any return for that matter I’ll receive no result.
Please do not suggest removing RETURN because this is a vendor stored procedure and can not be modified by me.
The procedure above is for demonstrating my point and is not representing actual data.
Thank you for you help
I’m trying to execute stored procedure on MS SQL using ODBC and QT
Assume that I already established connection to the database.
QSqlQueryModel model;
model.setQuery("{CALL test_proc}", m_Database );
if test_proc procedure is defined like
CREATE PROCEDURE TEST_PROC
AS
SELECT TOP 10 TITLE_ID, TITLE FROM TITLES
Everything is OK. The model receives data and I can display it in the table.
If test_proc procedure is defined like
CREATE PROCEDURE TEST_PROC
AS
SELECT TOP 10 TITLE_ID, TITLE FROM TITLES
RETURN 0
The model thinks that there is no data to receive and shows me that record set is empty.
I have tried to use the same procedures without using model but result was the same.
No matter if model is used or QSqlQuery as soon as I add RETURN 0 or any return for that matter I’ll receive no result.
Please do not suggest removing RETURN because this is a vendor stored procedure and can not be modified by me.
The procedure above is for demonstrating my point and is not representing actual data.
Thank you for you help