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 many types cache in asp net?
What is server side session?
Is asp.net free?
when a request is made in Life cycle of ASP.NET page .
If iam developing an application that must accomodate multiple security levels though secure login and my asp.net web appplication is spanned across three web-servers (using round-robbin load balancing) what would be the best approach to maintain login-in state for the users?
Can we have 2 web config files?
What are the difference between overriding and overloading?
What is cross page posting in asp net?
How can you debug your.net application?
Can you explain page lifecycle in net?
Explain client side state management system.
Define common type system?
Should I delete cookies?
What is razor? : asp.net mvc
How can you use a custom controls in ASP.NET application?