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
witch is the best insistute in sharpoint course.what abt future of share point course.
What are the advantages of passport authentication?
What’s the use of “GLOBAL.ASAX” file?
To bind columns manually which tags do you need to add within the asp:datagrid ?
14. What are your Future Plans for Swatz Oils GROUP U.K?
What is a form tag?
What is the difference between a default skin and a named skin?
Which protocol is used to call a web service?
What is Web Server Control Templates.?
What is the asp.net mvc folder conventions? : asp.net mvc
What is the difference between stored procedure vs function?
How to find last error which occurred in Asp.net ?
Can you explain the basic use of dataview?
Can you explain architecture of your project ?
What is a multilingual website?