GeekInterview.com
  I am new, Sign me up!
 
GeekInterview.com  >  Interview Questions  >  Microsoft  >  ASP.NET 2.0
Go To First  |  Previous Question  |  Next Question 
 ASP.NET 2.0  |  Question 108 of 161    Print  
What should the developer use in order to have an Active Server Page (ASP) invokes a stored procedure on a SQL Server database?

  
Total Answers and Comments: 3 Last Update: December 05, 2006     Asked by: Rahul 
  
 Sponsored Links

 
 Best Rated Answer

No best answer available. Please pick the good answer available or submit your answer.
November 09, 2006 13:06:24   #1  
tauhid        

RE: What should the developer use in order to have an ...

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


 
Is this answer useful? Yes | No
November 13, 2006 06:11:37   #2  
nitin        

RE: What should the developer use in order to have an ...

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


 
Is this answer useful? Yes | No
December 05, 2006 07:28:54   #3  
Rupesh Tiwary        

RE: What should the developer use in order to have an ...
After creating store procedure we use the name of store procedure as the parameter in sql command and then set commantType propertie.......
 
Is this answer useful? Yes | No


 
Go To Top


 Sponsored Links

 
About Us -  Privacy Policy -  Terms and Conditions -  Contact -  Ask Question -  Propose Category -  Site Updates 

Copyright © 2005 - 2009 GeekInterview.com. All Rights Reserved

Page copy protected against web site content infringement by Copyscape