How to Insert a TextBox value in to Sql database using C#
coding?
Answer Posted / jegan
SqlConnection con = new SqlConnection();
con.ConnectionString = "connection string(path)";
try
{
con.Open();
SqlCommand cmd = new SqlCommand("insert into emp_detail values(' " + tb1.Text + " ',' " + tb2.Text + " ',' " + tb3.Text + " ')", con);
cmd.ExecuteNonQuery();
con.Close();
}
catch (Exception ex)
{
throw new Exception(ex.ToString());
}
Is This Answer Correct ? | 66 Yes | 26 No |
Post New Answer View All Answers
Explain what is viewstate?
Why is the standalone environment only useful during the development process?
What is the difference between cache and cookies?
Can we set master page as a start page?
How do I create a web form?
How to send a DataReader as a parameter to a remote client ?
can any one find and tell the difference between dot net and php which one is best ? which one we get more salary? which one is stable and which one is best for freshers and also better in future and carrer ? which one we wil get more salary sir ? please send ur valuable suggestions to kiranpulsar2007@gmail.com
What is the usie of activex control in .net?
Explain how cookies work.
What is session in web technology?
Differentiate between a hyperlink control and a linkbutton control.
Explain different types of validators in asp.net?
What are the advantages of Web API?
What is parse in asp.net?
What is the difference between page-level caching and fragment caching?