public static int Delete(this SqlConnection connection, string tableName, KeyValuePair<string, object> condition) { string command = string.Format("DELETE FROM [{0}] WHERE {1} = @{1}", tableName, condition.Key); return connection.ExecuteNonQuery(command, new[] {condition.ToSqlParameter()}); }
public static SqlDataReader Select(this SqlConnection connection, string tableName, KeyValuePair<string, object> condition) { string command = string.Format("SELECT * FROM [{0}] WHERE {1} = @{1}", tableName, condition.Key); return connection.ExecuteReader(command, new[] {condition.ToSqlParameter()}); }