ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage   interview questions urls   External Links  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Code Snippets  >>  Programming Code  >>  Dot Net Code  >>  ADO.NET Code
 
 


 

 
 ASP.NET Code interview questions  ASP.NET Code Interview Questions
 VB.NET Code interview questions  VB.NET Code Interview Questions
 C Sharp Code interview questions  C Sharp Code Interview Questions
 ADO.NET Code interview questions  ADO.NET Code Interview Questions
Question
how to connect  bind a control to database by writing a 
stored procedure?
 Question Submitted By :: Tina
I also faced this Question!!     Rank Answer Posted By  
 
  Re: how to connect bind a control to database by writing a stored procedure?
Answer
# 1
dim con as sqlconncetion
dim cmd as sqlcommand
dim parm as sqlparameter
con=new sqlconnection
("server=localhost;database=Database1;username=sa;password=s
a")
cmd=new sqlcommand
con.open()
cmd.commandtype=commandtype.storedprocedure
cmd.commandtext="StoredprocedureName"
cmd.parmaeters.add("@Name",txtname.txt)
cmd.parameters.add("@sal",txtname.txt)
cmd.excutenonquery()
con.close()
 
Is This Answer Correct ?    0 Yes 0 No
Badrinath
 
  Re: how to connect bind a control to database by writing a stored procedure?
Answer
# 2
dim con as sqlconncetion
dim cmd as sqlcommand
dim parm as sqlparameter
con=new sqlconnection
("server=localhost;database=Database1;username=sa;password=s
a")
cmd=new sqlcommand
con.open()
cmd.commandtype=commandtype.storedprocedure
cmd.commandtext="StoredprocedureName"
cmd.parmaeters.add("@Name",txtname.txt)
cmd.parameters.add("@sal",txtname.txt)
cmd.excutenonquery()
con.close()
 
Is This Answer Correct ?    0 Yes 0 No
Badrinath
 
 
 
  Re: how to connect bind a control to database by writing a stored procedure?
Answer
# 3
SqlConnection conn = new SqlConnection(strconn);
SqlCommand comm = new 
SqlCommand"[StoreProcedureName]",conn);
comm.CommandType = CommandType.StoredProcedure;
comm.Parameters.AddWithValue("@UserId", Id);
sqldataadapter da= new sqldataadapter;
Dataset ds = new dataset;
try
{
conn.open();
da.fill(ds);
conn.fill;
}
catch
{
throw(ex);
}
dlFilldatalist.datasourse = ds;
dlFilldatalist.databind();
 
Is This Answer Correct ?    0 Yes 1 No
Shivani
 

 
 
 
Other ADO.NET Code Interview Questions
 
  Question Asked @ Answers
 
How we work on N tire architecture in asp.net Please give me Examle... HCL2
how to retrive file ,using file info on click event of a buton and disply it on a web form Activa-Softec1
In the Design view in Visual Studio 2005 of an ASP.NET web page, what is the easiest way to create an event handler for the default event of an ASP.NET server control?  1
how to connect bind a control to database by writing a stored procedure? Satyam3
 
For more ADO.NET Code Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com