Quantcast
Channel: SharePoint 2013 - Development and Programming forum
Viewing all articles
Browse latest Browse all 25064

SPQuery always returns the same item

$
0
0

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


Viewing all articles
Browse latest Browse all 25064

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>