I have the following code. The strKey is changed for each run, but the spquery returns the same SharePoint item to me although already set the query and item collection to null for each run. I think it may due to some kind cache. I am wonder if anyone has a solution for this issue. Thanks in advance.
while (oPt1.Read() && n < 10)
{
if (string.IsNullOrEmpty(oPt1["TelcoID"].ToString()))
{
oQuery = null;
collListItems = null;
strDiff = "";
strKey = fillZero(oPt1["InvCode"].ToString());
textBox1.Text = strKey;
textBox1.Refresh();
//search sharepoint item by InvCode
oQuery = new SPQuery();
oQuery.Query = "<Query><Where><Eq><FieldRef Name='InvCode' />"+
"<Value Type='Text'>"+strKey+"</Value></Eq></Where></Query>";
collListItems = list.GetItems(oQuery);
if (collListItems.Count > 0)
{
cItem = collListItems[0];
//compare each field