How to create a SQL connectoin


Type this code to create a sql connection :

//con is the object of SqlConnectoin
_
SqlConnectoin con= new SqlConnetoin();

con.ConnectionString = "Data Source =Sqlservername ; Initial Catalog = table name; Integrated Security = True";

con.Open();

//Here Sqlserver name = your computer name

(You can see your computer name by :

right click on MyComputer --> Properties
-->
Computer Name (tab) --> Change (BUtton)

//If you are connecting sql with user id and

password than remove Integrated security and type :

SqlConnectoin con= new SqlConnetoin();

con.ConnectionString = "Data Source =Sqlservername ; Initial Catalog = table name; User id = youruserid; password = yourpassrd";

con.Open();

for more help

www.dotnetask.blogspot.com

Under Construction