This topic is locked

Call a SQL Server Stored Procedure with parameters

9/14/2020 6:09:53 PM
PHPRunner General questions
D
DWill author

How do I call a SQL Server Stored Procedure with parameters? The "Help" manual is not very helpful. I can get the following to build successfully. However, I need to be able to pass in a parameter. Please Help!!!
return DB.Query("EXEC usp_SearchForFinanceInvoicesDocuments");
--------------

The Help manual gives the following examples:

Example 1: tDal.CustomerQuery("EXEC usp_SearchForFinanceInvoicesDocuments");
Error: error CS0103: The name 'tDal' does not exist in the current context
Example 2: tDAL.CustomQuery("EXEC usp_SearchForFinanceInvoicesDocuments '" + values["RequestNo"].ToString() + "'");

Error: error CS0103: The name 'values' does not exist in the current context

Sergey Kornilov admin 9/14/2020

It looks like you posted it in the wrong forum, this one is for PHPRunner, while you use ASPRunner.NET.
The second attempt seems to be closer but it looks like you are using it in the event where values array is not available. For test purposes start with the hardocoded parameter and once it works replace it with the variable.

D
DWill author 9/15/2020



It looks like you posted it in the wrong forum, this one is for PHPRunner, while you use ASPRunner.NET.
The second attempt seems to be closer but it looks like you are using it in the event where values array is not available. For test purposes start with the hardocoded parameter and once it works replace it with the variable.


Thanks. I thought I was in the ASPRunner Forum. I will move my question there. However, I'm actually using the hardcoded value. Thanks again.