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
Please brief not about xsd,xslt & xml?
How can you dynamically add user controls to a page?
What are the new web part controls in asp.net 2.0 ?
Which type if caching will be used if we want to cache the portion of a page instead of whole page?
What are the authentication types in asp.net?
Difference between Response.redirect vs server.transfer?
What is ispostback property?
Is asp.net outdated?
Explain transparent caching with aop?
Explain the difference between sql invalidation and sql notification.
What are the different properties of server control that exists?
What does clearing cache?
What is marshalling ? Is it a part of asp.net ?
Define secured sockets layer.
What is the difference between web.config and machine.config in ASP.NET?