c++ - QODBCResult::exec: Unable to execute statement: "[Microsoft][ODBC SQL Server Driver]COUNT field incorrect or syntax error -
i error when try call stored procedure in qt using qodbc:
qodbcresult::exec: unable execute statement: "[microsoft][odbc sql server driver]count field incorrect or syntax error
amount of parameters correct, syntax looks alright me. procedure executes fine in management studio. might problem?
qsqlquery query(db1); query.exec("select * teachers"); //test query tablewidget *table = ui->tablewidget; (int = 0; < table->rowcount(); i++) { qcombobox *combo = static_cast<qcombobox*>(table->cellwidget(i,0)); qdebug() << query.prepare("{call add_syllabus_line (?,?,?,?,?,?,?,?,?)}"); query.bindvalue("teacher_name", teachername); query.bindvalue("subject_name", "????"); query.bindvalue("temporary_name", ratingname); query.bindvalue("type_name", combo->currenttext()); query.bindvalue("activity_name", table->item(i, 1)->text()); query.bindvalue("min_score", table->item(i, 2)->text().toint()); if (propertiesinstance.fixed) query.bindvalue("max_score", 0); else query.bindvalue("max_score", table->item(i, 3)->text().toint()); query.bindvalue("max_score_exists", propertiesinstance.fixed); query.bindvalue("evaluation_by_exam", propertiesinstance.exam); if (!query.exec()) { qdebug() << query.lasterror(); } }
the procedure:
alter procedure [dbo].[add_syllabus_line] @teacher_name nvarchar(50), @subject_name nvarchar(50), @temporary_name nvarchar(50), @type_name nvarchar(50), @activity_name nvarchar(50), @min_score int, @max_score int, @max_score_exists bit, @evaluation_by_exam bit begin set nocount on; declare @teacher_id int; declare @subject_id int; declare @type_id int; select @teacher_id = teacher_id teachers teacher_name = @teacher_name; select @type_id = activity_type_id activity_types activity_type_name = @type_name; select @subject_id = subject_id subjects subject_name = @subject_name; insert syllabi (teacher_id, subject_id, temporary_name, activity_type_id, activity_title, activity_min_score, activity_max_score, max_score_exists, evaluation_by_exam) values (@teacher_id, @subject_id, @temporary_name, @type_id, @activity_name, @min_score, @max_score, @max_score_exists, @evaluation_by_exam); end
query.prepare
returns true.
i run profiler trace , query doesn't shows there, test one.
select 504,c.name,c.description,c.definition master.dbo.syscharsets c c.id = convert(tinyint, databasepropertyex ( db_name() , 'sqlcharset')) go
exec sp_datatype_info 11 go
set quoted_identifier on go
declare @p1 int set @p1=180150003
declare @p3 int
set @p3=8 declare @p4 int set @p4=1 declare @p5 int set @p5=3 exec sp_cursoropen @p1 output,n'select * teachers',@p3 output,@p4 output,@p5 output select @p1, @p3, @p4, @p5exec sp_cursorclose 180150003 go
other ensuring exact syntax being passed sql server using either profiler trace or extended events, dbcc inputbuffer etc, table being inserted have trigger might interfering?
Comments
Post a Comment