ListViewByQuery中只能查询自定义列表嘛?文档库,任务的列表查询都出错,请高手指教!
ListViewByQuery中只能查询自定义列表嘛?文档库,任务的列表查询都出错,请高手指教!
代码如下:
thisSite = SPContext.Current.Site;
SPWeb thisWeb = null;
thisWeb = thisSite.AllWebs[WebName];
MyCustomView.List = thisWeb.Lists[tb.Text.Trim()];
SPQuery query = new SPQuery(MyCustomView.List.DefaultView);
query.Query = "<Where><Geq><FieldRef Name='DT'/>"
+ "<Value type='DateTime'>"
+ "2009-01-01"
+ "</Value></Leq></Where>";
MyCustomView.Query = query;
[解决办法]
哈错误?
那个时间的格式貌似有点问题
[解决办法]
需要带上时:分:秒的,具体的格式如下:
query.Query = "<Where><Geq><FieldRef Name='DT'/>"
+ "<Value type='DateTime'>"
+ "2009-01-01 00:00:00"
+ "</Value></Geq></Where>";
MyCustomView.Query = query;
而且,您老人家的Caml语句也错误了,应该一个是Geq,一个是Leq,让他怎么查,应该统一一下。
[解决办法]
查询字符串格式有问题