private List<DatabaseUser> GetDatabaseUsers(int databaseId) { var _tmp = new List<DatabaseUser>(); using (OleDbConnection _conn = new OleDbConnection(Settings.Default.connectionString)) { _conn.Open(); using (OleDbCommand _cmd = new OleDbCommand(@"SELECT login, passwd FROM db_users WHERE (db_id = ?) AND (status = 'normal')", _conn)) { _cmd.CommandType = CommandType.Text; _cmd.Parameters.AddWithValue("ID", databaseId); using (OleDbDataReader _read = _cmd.ExecuteReader()) { while (_read.Read()) { var _d = new DatabaseUser(); _d.Username = _read["login"].ToString(); _d.Password = _read["passwd"].ToString(); _tmp.Add(_d); } } } _conn.Close(); } return _tmp; }
private List<DatabaseUser> GetMySqlDatabaseUsers(int databaseId) { var _tmp = new List<DatabaseUser>(); using (SQLiteConnection _conn = new SQLiteConnection(Settings.Default.connectionString)) { _conn.Open(); using (SQLiteCommand _cmd = new SQLiteCommand(@"SELECT Username, Password FROM DomainMySQLUser WHERE DatabaseId = $ID", _conn)) { _cmd.Parameters.AddWithValue("$ID", databaseId); using (SQLiteDataReader _read = _cmd.ExecuteReader()) { while (_read.Read()) { var _d = new DatabaseUser(); _d.Username = _read["Username"].ToString(); _d.Password = _read["Password"].ToString(); _tmp.Add(_d); } } } _conn.Close(); } return _tmp; }