コード例 #1
0
 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()});
 }
コード例 #2
0
 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()});
 }