PDA

View Full Version : MS SQL 2005, problem with varchar parameters of stored procedure



rusvid
10th December 2009, 05:51
There is stored procedure on MS SQL 2005:

ALTER procedure [dbo].[fp_test]
(
--@Number int out
@Value varchar(50) out
)
as
--select @Number = 777
select @Value = 'test string'

and there is client code:


QSqlQuery query;
//query.setForwardOnly(true);
query.prepare("{CALL dbo.fp_test(?)}");
//query.bindValue("Number",n,QSql::Out);
query.bindValue("Value", strValue,QSql::Out);
if (!query.exec()) return 1;
//n = query.boundValue("Number").toInt();
strValue = query.boundValue("Value").toString();

On Windows XP this code works successfully, but on Ubuntu 9.10 query.exec() returns false:
QODBCResult::exec: unable to bind variable: " [FreeTDS][SQL Server]Invalid data type"

For integer parameters this code works successfully on both systems (variable n == 777).
Then there is problem with varchar parameters only.

Can help me ?