11
Reply

How to creating a SqlConnection Object?

Sanjay Dixit

Sanjay Dixit

11y
1.6k
0
Reply

    SqlConnection conn = new SqlConnection("Data Source=DatabaseServer;Initial Catalog=DataBase_Name;User ID=UserID;Password=Password");

    SqlConnection conn = new SqlConnection("Data Source=DatabaseServer;Initial Catalog=Northwind;User ID=YourUserID;Password=YourPassword");

    connetionString="Data Source=ServerName; Initial Catalog=DatabaseName;User ID=UserName;Password=Password"

    SqlConnection conn = new SqlConnection("Server=servername;database=databasename;uid=sa;pwd=urpassword");

    SqlConnection con = new SqlConnection("Data Source=DatabaseServer;Initial Catalog=DataBase_Name;User ID=UserID;Password=Password");

    SqlConnection conn = new SqlConnection ("data source=databaseserver; Initial catalog=DataBase_Name; Integrated Security=True;");

    SqlConnection conn = new SqlConnection ("data source=databaseserver; Initial catalog=DataBase_Name; Integrated Security=True;");

    (1)Using System.Data.SqlClient; (2) SqlConnection con = new SqlConnection(); con.ConnectionString="Data Source=ABC;Initial Catalog=studentdetail;uid=sa; pwd=Password1";

    (1)Using System.Data.SqlClient; (2) SqlConnection con = new SqlConnection(); con.ConnectionString="Data Source=ABC;Initial Catalog=studentdetail;uid=sa; pwd=Password1";

    (1)Add namespace Using System.Data.SqlClient. (2) SqlConnection con = new SqlConnection(); con.ConnectionString="Data Source=ABC;Initial Catalog=studentdetail;uid=sa; pwd=Pass1";

    (1)Add namespace Using System.Data.SqlClient. (2) SqlConnection con = new SqlConnection(); con.ConnectionString="Data Source=ABC;Initial Catalog=studentdetail;uid=sa; pwd=Pass1";