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?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
samPosted Aug 27, 2010, 3:49 AM
http://www.fissionit.co.uk/forum/showthread.php?p=10325
ajay rajuPosted Aug 27, 2010, 1:40 AM
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