Forum Discussion

kish's avatar
kish
Contributor
13 years ago

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);





}

1 Reply

  • Hi,



    Can you clarify your request?

    If your stored procedure doesn't return a result, how do you expect to get anything from it? How do you normally get
    results from two tables in two rows
    from your stored procedure? Do you need to query your DB after doing this and get them?