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 sessions and cookies?

544


What is the extension of master page in asp.net?

524


what are the Custom controls in asp.net?

540


Explain the difference between server control and html control.

448


What is the benefit of WebAPI over WCF?

546






How do we implement bundling in MVC?

560


How do u deploy ur project?

2198


How do you hide the columns?

556


Explain about the Class view window?

565


How to set the pane area to transparent of a scrollPane component.?

546


Can you clarified A Web service can only be written in .NET or not?

514


What do you mean by serialize?

524


What is clr? Difference between clr & cts?

665


What is a web pool?

565


What are different types of api?

502