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

What is ado oledb and odbc?

945


How many major types of connection objects in ADO.NET?

1035


What is ado.net full form?

990


What are advantages of microsoft-provided data provider classes in ado.net?

1005


What is a dynaset in access?

1063


Explain the difference between sqlcommand object and command behavior object?

1084


What is ado connection?

953


What is the use of Dataview?

1133


What is datatable in ado.net?

969


describe the dataset object in ado.net.

959


What are all the different authentication techniques used to connect to MS SQL Server?

1089


What are all the classes that are available in System.Data Namespace?

1013


What provider ado.net use by default? Explain the role of data provider in ado.net? What is the role of data provider in ado.net?

988


Why is stored procedure used in ado.net?

1124


What is dbcontext and dbset in entity framework?

938