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
Web API supports which protocol?
Why select Web API?
What are the namespaces used in asp.net mvc? : asp.net mvc
What is the state management in asp.net?
What is a 401 redirect?
What tags do you need to add within the asp:datagrid tags to bind columns manually? How?
Is viewstate enabled by default?
What is asp net application object?
What are merge modules?
What is a postback ispostback and autopostback in asp net?
how to retrieve property settings from xml .config file.
What is viewstategenerator?
How does asp.net work?
What is a multilingual website?
How do you deploy your asp.net application?