В исходном вопросе мне предложили попробовать и привязывайте параметры один за другим.
Вот что у меня есть:
- Я изменил запрос так, чтобы он был :
Код: Выделить всё
query2 = L"INSERT INTO abcattbl SELECT ?, 'abcatcol', (SELECT object_id FROM sys.objects o, sys.schemas s WHERE s.schema_id = o.schema_id AND o.name = 'abcatcol' AND s.name = 'dbo'), \'\', 8, 400, \'N\', 0, 0, 34, 0, \'MS Sans Serif\', 8, 400, \'N\', 0, 0, 34, 0, \'MS Sans Serif\', 8, 400, \'N\', 0, 0, 34, 0, \'MS Sans Serif\', \'\' WHERE NOT EXISTS(SELECT * FROM dbo.abcattbl WHERE abt_tnam='abcatcol' AND abt_ownr='dbo');"; - Сценарий создания таблицы гласит:
Код: Выделить всё
IF NOT EXISTS (SELECT * FROM sysobjects WHERE name='abcattbl' AND xtype='U') CREATE TABLE \"abcattbl\"(abt_os tinyint, abt_tnam nchar(129) NOT NULL, abt_tid integer, abt_ownr nchar(129) NOT NULL, abd_fhgt smallint, abd_fwgt smallint, abd_fitl char(1), abd_funl integer, abd_fstr integer, abd_fchr smallint, abd_fptc smallint, abd_ffce char(18), abh_fhgt smallint, abh_fwgt smallint, abh_fitl char(1), abh_funl integer, abh_fstr integer, abh_fchr smallint, abh_fptc smallint, abh_ffce char(18), abl_fhgt smallint, abl_fwgt smallint, abl_fitl char(1), abl_funl integer, abl_fstr integer, abl_fchr smallint, abl_fptc smallint, abl_ffce char(18), abt_cmnt nchar(254) ); - Код привязки к первому параметру abt_os выглядит так:
Код: Выделить всё
ret = SQLBindParameter( stmt, 1, SQL_PARAM_INPUT, SQL_C_TINYINT, SQL_TINYINT, 0, 0, &osid, 0, &cbParam[2] ); if( ret != SQL_SUCCESS && ret != SQL_SUCCESS_WITH_INFO ) { GetErrorMessage( errorMsg, STMT_ERROR, stmt ); result = 1; }
Подробнее здесь: https://stackoverflow.com/questions/793 ... -need-data