public static SqlConnection ConnectionData(Server ser,string mode,string username,string pass) { try { string cnStr = ""; if (mode == "AUT") { cnStr = @"Server =" + ser.Server_name + @";Database = " + ser.Database_name + @"; Integrated Security = True; Asynchronous Processing = True"; cn = new SqlConnection(cnStr); cn.Open(); return cn; } else if (mode == "SQL") { cnStr = @"Server =" + ser.Server_name + @";Database = " + ser.Database_name + @"; User ID="+username+";Password="******";Trusted_Connection=False;"; cn = new SqlConnection(cnStr); cn.Open(); return cn; } return null; } catch (Exception) { throw; } }
public get_GUI() { sr = new Server(); sr.Server_name = @"THANH\SQLEXPRESS"; sr.Database_name = "POS"; //cmd=new SqlCommand(); }
public get_GUI() { sr = new Server(); //sr.Server_name = @"THANH\SQLEXPRESS"; //sr.Database_name = "POS"; sr.Server_name = serverName; sr.Database_name = databaseName; sr.Mode = Mode; sr.UserName = UserName; sr.Password = Password; //cmd=new SqlCommand(); }
public Test() { sr = new Server(); sr.Server_name = @"VISKY_THANH\SQLEXPRESS"; sr.Database_name = "test"; }