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 exception be handled with out the use of try catch?
What is a gridview in asp.net?
IN an ASP.NET Web application if there is any error, how can you debug?
What is server infrastructure?
Please briefly explain the usage of global.asax?
What is asp.net globalization?
What is cas?
how to write html code with ssl
What is the mvc model?
What tags do you need to add within the asp:datagrid tags to bind columns manually? Give an example.
How does asp net store session ids by default?
Why do we need master page in asp.net?
Why would anyone need to implement their own hashtable or linked list?
In order to bind the data from a data source to the Repeater control what property is set and what method must you call in your code,?
Why we are using mvc instead of asp.net? : Asp.Net MVC