Method ExecuteNonQuery
ExecuteNonQuery(String, IDictionary)
Executes delete statements on Cache.
Declaration
public virtual int ExecuteNonQuery(string query, IDictionary values)
Parameters
Type | Name | Description |
---|---|---|
System.String | query | simple SQL like query syntax |
System.Collections.IDictionary | values | The IDictionary of attribute names and values. |
Returns
Type | Description |
---|---|
System.Int32 | returns the number of rows affected. |
Examples
Only Delete Query is supported yet.
These operators are supported by NCache Queries.
- Comparison Operators = , == , != , <> , < , > , <=, >=, IN
- Logical Operators AND , OR , NOT
- Miscellaneous () , DateTime.Now , DateTime("any date time compatible string")
Cache _cache = NCache.InitializeCache("myCache");
Hashtable values = new Hashtable();
values.Add("Name", "Paul Jones");
string query="delete Test.Application.Employee where this.Name = ?";
ICacheReader reader=_cache.ExecuteNonQuery(query,values);
values.Clear();
values.Add("Salary", 2000);
query="delete Test.Application.Employee where this.Salary > ?";
reader=_cache.ExecuteNonQuery(query,values);
values.Clear();
values.Add("Name", "Paul jones");
values.Add("Salary", 2000);
query="delete Test.Application.Employee where this.Name = ? and this.Salary > ?";
reader=_cache.ExecuteNonQuery(query,values);
values.Clear();
values.Add("Name", "Paul Jones");
values.Add("Salary", 2000);
query="delete Test.Application.Employee where Not(this.Name = 'Paul Jones' and this.Salary > 2000)";
reader=_cache.ExecuteNonQuery(query,values);