我緊跟在ADOdb documentation的指示,我想一個SQL服務器上執行2008數據庫,像這樣一個存儲過程:如何使用ADOdb PHP庫執行MSSQL存儲過程?
$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-> InParameter()調用中提供了List_ID參數。如我錯了請糾正我。在任何迴應'在param名稱前添加一個@'之前,文檔記錄並不需要,我已經嘗試過了,它會導致相同的錯誤消息。
感謝
對於初學者,你可以檢查'InParameter'返回的值,看看它實際上是結合值或默默地失敗。 – 2012-01-27 18:39:45
@ dev-null-dweller:好的,InParameter調用返回false,但沒有解釋爲什麼它失敗。任何方式來找出它爲什麼返回false? – Ryan 2012-01-27 19:23:23