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
What are sessions in asp net?
How ASP.NET page works?
How many validators do ASP.NET have?
How will you do Redo and Undo in a TextControl?
Which methods validate all the controls on a page?
Explain login control and form authentication.
What does postback mean?
Is there any limit for query string? Means what is the maximum size?
What is the advantage of mvc over asp.net? : Asp.Net MVC
How you can manage the state of application at the server side in ASP.NET?
Can you explain one critical mapping? Performance issue which one is better? Whether connected lookup tranformation or unconnected one?
What is cache in asp net?
Where viewstate value is stored in asp.net?
What are the advantages of the code-behind feature?
How can you ensure a permanent cookie?