我已经按照ADOdb documentation中的说明操作了,我正试图在sql server 2008数据库上执行存储过程,如下所示:
$stmt = $db->PrepareSP('usp_insert_aweber_list');
$db->InParameter($stmt,$id,'List_ID',false,SQLINT4);
$db->InParameter($stmt,$name,'Name',255,SQLVARCHAR);
$db->InParameter($stmt,$campaigns_collection_link,'Campaign_Collections_Link',255,SQLVARCHAR);
$db->InParameter($stmt,$custom_fields_collection_link,'Custom_Fields_Collection_Link',255,SQLVARCHAR);
$db->InParameter($stmt,$http_etag,'HTTP_Etag',255,SQLVARCHAR);
$db->InParameter($stmt,$resource_type_link,'Resource_Type_Link',255,SQLVARCHAR);
$db->InParameter($stmt,$self_link,'Self_Link',255,SQLVARCHAR);
$db->InParameter($stmt,$subscribers_collection_link,'Subscribers_Collection_Link',255,SQLVARCHAR);
$db->InParameter($stmt,$total_subscribers,'Total_Subscribers',false,SQLINT4);
$db->InParameter($stmt,$total_subscribed_subscribers,'Total_Subscribed_Subscribers',false,SQLINT4);
$db->InParameter($stmt,$total_subscribers_subscribed_today,'Total_Subscribers_Subscribed_Today',false,SQLINT4);
$db->InParameter($stmt,$total_subscribers_subscribed_yesterday,'Total_Subscribers_Subscribed_Yesterday',false,SQLINT4);
$db->InParameter($stmt,$total_unconfirmed_subscribers,'Total_Unconfirmed_Subscribers',false,SQLINT4);
$db->InParameter($stmt,$total_unsubscribed_subscribers,'Total_Unsubscribed_Subscribers',false,SQLINT4);
$db->InParameter($stmt,$web_form_split_tests_collection_link,'Web_Form_Split_Tests_Collection_Link',255,SQLVARCHAR);
$db->InParameter($stmt,$web_forms_collection_link,'Web_Forms_Collection_Link',255,SQLVARCHAR);
$rs = $db->Execute($stmt);
if (!$rs){
print $db->ErrorMsg();
echo '<br /><br />';
}
上面的代码只输出以下错误信息:
[Microsoft][ODBC SQL Server Driver][SQL Server]Procedure or function 'usp_insert_aweber_list' expects parameter '@List_ID', which was not supplied.
我相信我在第一个$ db-&gt; InParameter()调用中提供了List_ID参数。如我错了请纠正我。在回复“在param名称前添加@”之前,文档说明它不需要,我已经尝试过了,它会导致相同的错误消息。
由于
答案 0 :(得分:2)
我刚看了ADOdb 5.13(以及5.14&amp; 5.15 changelog未提及该区域的任何更改)代码,似乎MSSQL的ODBC驱动程序不支持对预准备语句的绑定参数,并且不会产生任何错误你正试图这样做。
答案 1 :(得分:0)
我已经看到这对早期版本的SQL Server起作用,但仅在使用'mssql'驱动程序时(而不是odbc_mssql或ado_mssql)。