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

Can you edit data in the Repeater control? Which template must you provide, in order to display data in a Repeater control? How can you provide an alternating color scheme in a Repeater control? What property must you set, and what method must you call in your code, in order to bind the data from some data source to the Repeater control?

782


What is in a session cookie?

723


Define xmlreader class.

763


How to make sure that contents of an updatepanel update only when a partial postback takes place (and not on a full postback)?

724


What is the use of placeholder control?

761


What is state management react?

710


while developing webservices if i want some users to use my webservice only how can i give security to my webservice?

1615


How does u get record no from 5 to 15 from a dataset of 100 records?

728


what is a .xap file? Explain with an example.

782


Explain cashing in asp.net.

730


How do you remove duplicates without using remove duplicate stage?

807


What is postback and autopostback in asp.net?

755


Which protocol is used to call web service?

740


How is application management and maintenance improved in asp.net 2.0?

745


Are there any resources for drop-in replacements for the default css that comes with the ASP.NET Website template?

757