Hi
What is SQL Connection command?
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.
Manoj Singh PanwarPosted Oct 31, 2011, 8:25 PM
first you need to include
Using System.Data.SqlClient;
//then create swl connection :
Sqlconnection scon = new Sqlconnection("server = .\\sqlexpress ; database = your database name; integrated security = true");
// now the sql command is written as :
SqlCommand comm = new SqlCommand("insert into tablename values(@p1,@p2)",scon);
// now inserting values of p1,p2
//Here I have used two parameters one is varchar and its value is inserted by textbox.
com.Parameters.Add(@p1,SqlDbType.Varchar,50).value = textbox1.text;
// similarly you can insert values for other parameters.