Hi..
I have two textboxes with submit button.
I want to insert the values entered in these textboxes into ms sql database.
I tried googling around,but i cant find any appropriate one.
Any tutorial suggestions guys?
Insert data into sql database
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

ajay rajuRank #4,639 · 333 reputationPosted Aug 26, 2010, 9:40 PM EDT
hi friend use this code
name spaces
using System.Data;
using System.Data.SqlClient;
code under submit button click
SqlConnection cn = new SqlConnection("user id=sa; password=123; database=emp" );
string str = "insert into emp values ('" + TextBox1.Text + " ',' " + TextBox2.Text + "')";
SqlDataAdapter da = new SqlDataAdapter(str,cn);
DataSet ds = new DataSet();
SqlCommandBuilder cb = new SqlCommandBuilder(da);
da.Fill(ds,"em");
Response.Write("Record saved into Database");
If it is helps you please mark as accept answer
Thanks
sam147 reputationPosted Aug 26, 2010, 11:49 PM EDT
http://www.fissionit.co.uk/forum/showthread.php?p=10325