public static SqlDataReader executeQuery(string query) { SqlDataReader result = null; try { SqlCommand com = new SqlCommand(query, DatabaseConection.getInstance()); com.CommandText = query; result = com.ExecuteReader(); } catch (SqlException e) { if (result != null & !result.IsClosed) { result.Close(); } throw e; } return(result); }
public static SqlDataReader executeQuery(SqlCommand command) { command.Connection = DatabaseConection.getInstance(); return(command.ExecuteReader()); }