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
How can we use Web API with ASP.NET Web Form?
What permissions do asp.net applications posses by default?
How can we register exception filter globally?
Define the steps to set up validation control.
What is full trust in asp.net?
What is the difference between session and viewstate?
Explain the flow of processing of the request? : asp.net mvc
Can you explain one critical mapping?
What do you mean by caching in asp.net?
what are the events raised in asp.net page life cycle?in which stage view state can be loaded?
Is asp.net is a programming language?
What is autopostback in dropdownlist in asp net?
I’m having some trouble with cas. How can I diagnose my problem?
How does u call and execute a sp in .net?
Explain the purpose of storyboard.targetproperty.