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

What are resource file and how do we generate resource file?

570


Whta are the Various steps taken to optimize a web based application (caching, stored procedure etc.) ?

560


What is the use of response redirect in asp.net?

581


What is latest version of asp.net mvc? : Asp.Net MVC

481


Explain how do you deploy your asp.net application?

485






How do you store a value in viewstate and retrieve them?

570


What is the difference between user control and custom control?

487


How ASP.NET page works?

678


Define viewstate in .net?

546


Can the unique key be null?

570


What are the events that happen when a client requests an asp.net page from iis server?

488


How to create discussion forum in asp.net mvc? : Asp.Net MVC

533


How to display validation messages in one control?

551


What New Features comes with ASP.NET Web API 2.0?

545


Explain what is clr?

630