I want to return DataReader from a Function. so i can use it regardless of its is MySQL or MS-SQL?
private void Connection(string Command) { if (DBtype == "MySQL") { MySqlConnection MysqlConnection1 = new MySqlConnection(CS); MySqlCommand MySqlcommand = new MySqlCommand(Command, MysqlConnection1); MysqlConnection1.Open(); MySqlDataReader reader = MySqlcommand.ExecuteReader(); } else { SqlConnection sqlConnection1 = new SqlConnection(CS); SqlCommand Sqlcommand = new SqlCommand(Command, sqlConnection1); sqlConnection1.Open(); SqlDataReader reader = Sqlcommand.ExecuteReader(); } }
OdbcConnection, etc.) - it will unify the databases.voidif you want to return something?