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

Difference between .NET and previous version?

2089


Can we set which type of comparison we want to perform by the CompareValidator control?

507


what is command line compiler.what are the steps and how it is related to debugging.

1402


What are the various ways to send content from one page to another?

513


Explain what is an abstract class?

540






How can exception be handled with out the use of try catch?

529


What are the media types of http requests and response?

502


what is the difference between response.write() and response.output.write()?

684


What are the ways to show data grid inside a data grid for a master details type of tables? If we write any code for DataGrid methods, what is the access specifier used for that methods in the code behind file and why?

575


What is the difference between the asp and asp.net?

479


Write a code snippet to implement the indentation in json in web api.

569


What is asp net_sessionid?

631


What is ASLM?

673


what are the ihttphandler and ihttphandlerfactory interfaces ?

497


What is the base class from which web forms are inherited?

518