kish
13 years agoContributor
How to get a stored procedure results?
Hi,
I need to execute a stored procedure - dbo.GetOrderAndBillingContacts which has only one input parameter an no out parameter.
After executing this SP in SQL , i am getting results from two tables in two rows.
I have followed your 'Call an SQL Stored Procedure' and i didn't get appropriate results.
Please help how to proceed?
function Test()
{
var SProc;
SProc = ADO.CreateADOStoredProc();
SProc.ConnectionString = "Provider=SQLOLEDB;Persist Security Info=True;User ID=mossdev;Password=M1sadm1n;Initial Catalog=mis;Data Source=CSSBEDTESTSQL";
SProc.ProcedureName = "dbo.GetOrderAndBillingContacts";
// Adding an in parameter:
SProc.Parameters.AddParameter();
SProc.Parameters.Items(0).name = "IntCustomerId";
SProc.Parameters.Items(0).DataType = adSmallInt;
SProc.Parameters.Items(0).Size = 32;
SProc.Parameters.Items(0).Value = 5052;
// Running the procedure
SProc.ExecProc();
// Obtaining the return value
Log.Message("Result: " + SProc.Parameters.Items(0).Value);
}
I need to execute a stored procedure - dbo.GetOrderAndBillingContacts which has only one input parameter an no out parameter.
After executing this SP in SQL , i am getting results from two tables in two rows.
I have followed your 'Call an SQL Stored Procedure' and i didn't get appropriate results.
Please help how to proceed?
function Test()
{
var SProc;
SProc = ADO.CreateADOStoredProc();
SProc.ConnectionString = "Provider=SQLOLEDB;Persist Security Info=True;User ID=mossdev;Password=M1sadm1n;Initial Catalog=mis;Data Source=CSSBEDTESTSQL";
SProc.ProcedureName = "dbo.GetOrderAndBillingContacts";
// Adding an in parameter:
SProc.Parameters.AddParameter();
SProc.Parameters.Items(0).name = "IntCustomerId";
SProc.Parameters.Items(0).DataType = adSmallInt;
SProc.Parameters.Items(0).Size = 32;
SProc.Parameters.Items(0).Value = 5052;
// Running the procedure
SProc.ExecProc();
// Obtaining the return value
Log.Message("Result: " + SProc.Parameters.Items(0).Value);
}