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
Describe the differences between the lifecycles of Windows services and Standard EXE?
I have an excel file with data, i am importing this excel file data into Sqlserver 2005 database. while importing i am getting wrong data(ie, special characters) in one column(description column), upto some limit the data in that column is coming fine,after that data is coming like below. The "Walter" leather storage bench is one of our most popular styles. The top with the tufting and double stitching finish a very impressive piece. The size is perfect in front of beds and the storage adds another functional bonus. Open it up and sneak al���Ƴ�Â��ƴ�Ã��ƶ�Å�� al���Ƴ�Â��ƴ�Ã��ƶ�Å�� Is there anywhy to resolve this? (I am using recordset in coding for developing import process.) please help me soon.
Explain the main function of url routing system in asp.net mvc? : asp.net mvc
Describe the events in the life cycle of a web application.
benefits of migration from asp to asp.net hi frnds, i have to give presentation to a client about how useful would be migrating their project from asp to asp.net .plz give me some points which i should incorporate in my ppt thanks
Why do we need Sessions?
How should I destroy my objects in asp.net?
Explain about asp.net caching?
What is globalization and localization in asp net?
Can we have multiple worker process in an ASP.NET application? If so then how it has been handled by application? And who handles it?
What is custom events?
What is a reflection?
How do you change the session time-out value?
What is a form tag?
How do I use response redirect?