.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

Store procedure

Posted By: Chandranshu Awasthi     Posted Date: July 18, 2011    Points:5   Category :C#
Hi
i m using this code to call the procedure but the error is coming in connection string. can anyone pls help me

SqlCommand cmd = new SqlCommand("AesReport",cn.con);
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Srno", p.Srno);
da = new SqlDataAdapter(cmd);
da.Fill(dt);
cmd.ExecuteNonQuery();


Responses
Author: Arul             
Posted Date: July 18, 2011     Points: 20   

Hi,

Open the sql connection & specify commandtext.

Thanks,
Arul

Author: Narayanan             
Posted Date: July 18, 2011     Points: 20   

Hi,
Specify Commandtext



Regards, Lakshmi Naraayanan.S
http://dotnettechrocks.blogspot.in/
Author: Sasi Prabhu             
Posted Date: July 18, 2011     Points: 20   

Try

SqlCommand cmd = new SqlCommand("AesReport",con); 
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@Srno", p.Srno);
con.Open();
cmd.ExecuteNonQuery();
con.Close();





Thanks & Regards,
Sasi Prabhu.
Author: RAJ             
Posted Date: July 20, 2011     Points: 20   

hi
first u specify the command text like
sqlconnection cn=new sqlconnection("connectionstring");
sqlcommand cmd=new sqlcommand();
cmd.connection=con;
cmd.commandtype=commandtype.storedprocedure;
cmd.commandtext="name of the strored procedure";
cmd.parameters.addwithvalue("@sno",textbox1.text)
--
cn.open();
cmd.executenonquerey();
cn.close();

Regards
--------
Raju
Author: Gowthammanju             
Posted Date: July 29, 2011     Points: 20   

try these as


http://www.dotnetspark.com/userkb/Gowthammanju-Page-1.aspx

Thanks & Regards,
GowthamManju
Chennai



Mark if the answer is true
Author: RAJ             
Posted Date: July 30, 2011     Points: 20   

first u specify the connection and open the connection
after u specify the commantext like
cmd.commandtext="nameofthestoredprocedure"

Regards
--------
Raju


Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend