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 explain page lifecycle in net?

742


WSDL means?

920


What is application in asp net?

692


What is server side in asp.net?

740


Mention the execution process for managed code?

760


How is a session stored and maintained in asp.net?

755


Is asp.net is a programming language?

716


Where do the cookie state and session state information be stored?

722


Where sessions are stored?

890


Can viewstate be accessed in another page?

754


What is the difference between ldap and active directory?

792


What is an imagemap in asp.net?

791


Why mvc is better than asp.net? : Asp.Net MVC

695


What does the hotspot class in .net do?

779


Explain an object, class and method.

760