Executes delete statements on Cache.

Namespace: Alachisoft.NCache.Web.Caching
Assembly: Alachisoft.NCache.Web (in Alachisoft.NCache.Web.dll) Version: 4.3.0.0 (4.3.0.0)

Syntax

C#
public virtual int ExecuteNonQuery(
	string query,
	IDictionary values
)
Visual Basic
Public Overridable Function ExecuteNonQuery ( 
	query As String,
	values As IDictionary
) As Integer
Visual C++
public:
virtual int ExecuteNonQuery(
	String^ query, 
	IDictionary^ values
)

Parameters

query
Type: System..::..String
simple SQL like query syntax
values
Type: System.Collections..::..IDictionary
The IDictionary of atribute names and values.

Return Value

Type: Int32
returns the number of rows affected.

Examples

Only Delete Query is supported yet. These operators are supported by NCache Queries. 1. Comparison Operators = , == , != , <> , < , > , <=, >=, IN 2. Logical Operators AND , OR , NOT 3. Miscellaneous () , DateTime.Now , DateTime("any date time compatible string")
 Copy imageCopy
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);

See Also