Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

Call a stored procedure from ado.net and pass parameter to it ?

Answer Posted / suman zalodiya

SqlConnection con = new SqlConnection("Your Databse
Connection String");

SqlCommand cmd = new SqlCommand("Stored Procedure Name",
con);

cmd.CommandType = CommandType.StoredProcedure;

cmd.Parameters.Add("@source", SqlDbType.VarChar, 50).Value
= TextBox1.Text;

cmd.Parameters.Add("@destination", SqlDbType.VarChar,
50).Value = TextBox2.Text;

con.Open();

cmd.ExecuteNonQuery();
con.Close();

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can we do database operations without using any of the ado.net objects?

929


What are the different layers of ado.net?

1010


What are the namespaces used in ado.net for data access?

918


What does ado stand for?

865


How to check if the Dataset has records ?

944


What is commandbuilder in ado.net?

951


What are typed and untyped dataset?

1041


What are the data access namespaces in .NET?

1129


What does ole stand for in excel?

1059


What is the difference between sqlcommand and sqldataadapter?

942


Which is faster datareader or dataadapter?

933


Explain the difference between sqlcommand object and command behavior object?

1004


What is bubbled event?

914


Compare Data Reader & Dataset in ado.net?

940


What is the difference between Data adaptor and Data set?

974