public void test() { MySqlDataReader oReader = myExecuteReader(selectQuery); oReader.Close(); } public MySqlDataReader myExecuteReader(string SQL_STRING) { //Function to Accept a SQL String and Return a Data Reader //Declare Objects MySqlConnection oCn = null; MySqlCommand oCmd = null; MySqlDataReader oRdr = null; try { //Open Connection oCn = new MySqlConnection(ConfigurationSettings.AppSettings["SQLConnectionString"]); oCn.Open(); //Open the MySqlCommand object oCmd = new MySqlCommand(SQL_STRING, oCn); //Return the Data Reader to the callee oRdr = oCmd.ExecuteReader(System.Data.CommandBehavior.CloseConnection); } catch (Exception ex) { ExceptionLogger.LogException(ex); } return oRdr; } //End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)