Quantcast
Channel: SharePoint 2010 - Development and Programming forum
Viewing all articles
Browse latest Browse all 11508

Modified date compare with othere date column.

$
0
0

Hi

I have one list(XYZ and there are 3 column(Title,ldate,Modified)), now i want modified date >= ldate using camal query.

I have tried but got error like "

ERROR : “A field or property with the name 'ldate' was not found on the selected data source”

"

SPWeb web =SPContext.Current.Web;

 

           SPList list = web.Lists["datecheck"];

 

           SPQuery query = newSPQuery();

 

            query.ViewFields =@"<Where><And><Geq><FieldRef Name='Modified' /><Value IncludeTimeValue='TRUE' Type='DateTime'></Value></Geq><Leq><FieldRef Name='ldate' /><Value IncludeTimeValue='True' Type='DateTime'></Value></Leq></And></Where>";

            //"<Where><And><Leq><FieldRef Name='ldate'/> <Value IncludeTimeValue='FALSE' Type='DateTime'></Value></Leq><Geq><FieldRef Name='Modified'/><Value Type='DateTime'></Value>  </Geq>    </And></Where>";

               //"<FieldRef Name='ID'/>" + "<FieldRef Name='Title'/>" + "<FieldRef Name='ldate'/>" + "<FieldRef Name='Modified'/>";

             //@"<Where><And><Leq><FieldRef Name='ldate'/> <Value Type='DateTime'>{date}</Value></Leq><Geq><FieldRef Name='Modified'/><Value Type='DateTime'>{date}</Value> </Geq>   </And></Where>";

               

            

            SPListItemCollection item = list.GetItems(query);

 

            GridView1.DataSource = item.GetDataTable();

 

            GridView1.DataBind();

Radheshyam Mali


Viewing all articles
Browse latest Browse all 11508

Trending Articles



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