this is my xquery
i want to return the value from xquery between $searchHotelCode/dtDateFrom and $searchHotelCode/dtDateTo But my query it is not running
my xquery passing value for particluar case is
{FOR $searchHotelCode in document(‘HotelNav’)/Hotels/Hotel where $searchHotelCode/vcAssociatevcAssociateCode=‘HRY’ and $searchHotelCode/vcPlaceCode=‘DEL’ and $searchHotelCode/vcRateType=‘Special FIT’ and $searchHotelCode/vcCountryValidity= ‘General’ and ( $searchHotelCode/dtDateFrom >=‘12/21/2008’ and $searchHotelCode/dtDateTo<=‘12/21/2008’) RETURN $searchHotelCode }
string strXMLPlace = HttpContext.Current.Server.MapPath("~/XML/Hotelinformation.xml");
string strNavNamePlace = “HotelNav”;
XQueryNavigatorCollection navcolPlaces = new XQueryNavigatorCollection();
XmlDocument xDocPlace = new XmlDocument();
xDocPlace.Load(strXMLPlace);
navcolPlaces.AddNavigator(xDocPlace.CreateNavigator(), strNavNamePlace);
// string strXQuery = “{FOR $searchHotelCode in document(‘HotelNav’)/Hotels/Hotel where $searchHotelCode/vcAssociatevcAssociateCode=’” + strHotelCode.Trim() + “’ and $searchHotelCode/vcPlaceCode=’” + strHotelPlaceCode + “’ and $searchHotelCode/vcRateType=’” + strRatetype + “’ and $searchHotelCode/vcCountryValidity= '” + strCountryValidity+"’ and ($searchHotelCode/dtDateFrom >=’" + ToDate+"’ and $searchHotelCode/dtDateTo <= ‘" +ToDate +"’) RETURN $searchHotelCode }";
string strXQuery = “{FOR $searchHotelCode in document(‘HotelNav’)/Hotels/Hotel where $searchHotelCode/vcAssociatevcAssociateCode=’” + strHotelCode.Trim() + “’ and $searchHotelCode/vcPlaceCode=’” + strHotelPlaceCode + “’ and $searchHotelCode/vcRateType=’” + strRatetype + “’ and $searchHotelCode/vcCountryValidity= '” + strCountryValidity + “’ and ( $searchHotelCode/dtDateFrom >=’” + ToDate + “’ and $searchHotelCode/dtDateTo<=’” + ToDate + “’) RETURN $searchHotelCode }”;
XQueryExpression xexpr = new XQueryExpression(strXQuery);
string resultXML = xexpr.Execute(navcolPlaces).ToXml();
DataSet ds = new DataSet();
DataSet dsHotelInformation = new DataSet();
ds.ReadXml(new StringReader(resultXML));
if (ds.Tables.Count > 0)
{
// strHotelCode = ds.Tables[0].Rows[0][0].ToString();
}
// return strHotelCode;
return ds;
<?xml version="1.0" encoding="utf-8" ?>
HRY
STAR HOTEL
DEL
Standard Rooms
11/11/2008
03/31/2009
Special FIT
General
INR
1680/1830/600
HRY
STAR HOTEL
DEL
Deluxe Rooms
11/11/2008
03/31/2009
Special FIT
General
INR
2535/2685/600
HRY
STAR HOTEL
DEL
Super Deluxe Double Rooms
11/11/2008
03/31/2009
Special FIT
General
INR
4065/4215/600
I’m not really sure, how this related to functionality of component?
The grid itself is fully client side and not related to any server side functionality, it just need an xml stream with data in predefined format.