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

Answer Posted / ramachandraprabu

SqlConnection conn = new SqlConnection(strCon);
SqlCommand CmdSql = new SqlCommand("INSERT INTO Customers
(Firstname,Lastname,Address)Values('" + textbox1.Text
+ "', '"+textbox2.Test+"', '"+textbox3.Text+"')", conn);
CmdSql.ExecuteNonQuery();


\\If u use Html control we must use
textbox1.value
\\If u use asp.net controls we have to use
textbox1.text

Is This Answer Correct ?    51 Yes 23 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the difference between asp and asp.net?

516


How can we create pie chart in asp.net?

593


What is the difference between executescalar and executenonquery?

522


What is caching in asp.net?

571


What is authentication in asp.net?

579






What is asp.net? How is it different from asp?

548


Explain the difference between asp.net mvc and asp.net webforms? : asp.net mvc

539


What does postback mean?

547


Explain the difference between Web Garden and Web Farm?

560


What is Cookies Less Session?

622


Tell me what is the request flow used for asp.net mvc framework? : asp.net mvc

560


What is user control in asp.net?

526


What is globalization and localization in asp net?

504


What is OSI layer? Explain different layers.

617


Is sql backend or frontend?

565