What should the developer use in order to have an Active Server Page (ASP) invokes a stored procedure on a SQL Server database?

Showing Answers 1 - 3 of 3 Answers

tauhid

  • Nov 9th, 2006
 

first create a new connection object and open the connection

second create a command object identifying the stored procedure

third set the command object so it knows to execute  a stored procedure

fourth add a parameters to the command, which will passed to the stored procedure

  Was this answer useful?  Yes

nitin

  • Nov 13th, 2006
 

please find the code for the same

//code for connection to db

SqlConnection conn = new SqlConnection("Data Source=servername;Initial Catalog=northwind(dbname);uid=sa;pwd=sa");

//sqlcommand

SqlCommand cmdsp = new SqlCommand("SPname", conn);

cmdsp.CommandType = CommandType.StoredProcedure;

cmdsp.Parameters.Add("@parametername", SqlDbType.Int).Value = Request.QueryString["id"];

SqlDataAdapter da = new SqlDataAdapter(cmdsp);

DataSet ds = new DataSet();

da.Fill(ds, "xyz");

any comments or corrections most welcome.

thanks,

Nitin

Rupesh Tiwary

  • Dec 5th, 2006
 

After creating store procedure , we use the name of store procedure as the parameter in sql command and then set commantType propertie.......

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions