How to Insert a TextBox value in to Sql database using C#
coding?

Answer Posted / balakumar

string strconn = @"Data Source=localhost;
Initial Catalog=Bala;
Trusted_Connection=yes;";
SqlConnection conn = new SqlConnection(strconn);
conn.Open();
string insertcommand = "insert into Employee
values('" + TextBox1.Text + "','" + TextBox2.Text + "','" +
TextBox3.Text + "')";
SqlCommand cmd = new SqlCommand(insertcommand, conn);
cmd.ExecuteNonQuery();
conn.Close();

Is This Answer Correct ?    3 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are the types of session in asp.net?

521


Which is faster viewdata or viewbag?

534


Which authentication uses a combination of windows and iis authentication?

578


What is difference between singleton and single call?

638


What is difference between session and viewstate?

467






Which method is used to enforce garbage collection in .net?

421


What is the procedure to handle the process request using mhpm events fired? : asp.net mvc

533


What is the application pool?

539


What is the use of ASP.NET routing?

556


Why session is necessary in web application?

507


Where is the session stored?

626


Is asp.net and .net same?

533


What is the difference between asp.net and mvc?

578


What are the media types of http requests and response?

502


what are the events raised in asp.net page life cycle?in which stage view state can be loaded?

544