Start Building Professional
Web Apps Today


 
Categories Question details Back To List
Question  posted by Purushottam Dwivedi on Dec 17, 2008 21:40
open dhtmlx forum
xquery problem in grid

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

<root>{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 }</root>





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 = "<root>{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 }</root>";
string strXQuery = "<root>{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 }</root>";
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" ?>
<Hotels>
<Hotel>
<vcAssociateCode>HRY</vcAssociateCode>
<vcAssociateName>STAR HOTEL</vcAssociateName>
<vcPlaceCode>DEL</vcPlaceCode>
<vcRoomType>Standard Rooms</vcRoomType>
<dtDateFrom>11/11/2008</dtDateFrom>
<dtDateTo>03/31/2009</dtDateTo>
<vcRateType>Special FIT</vcRateType>
<vcCountryValidity>General</vcCountryValidity>
<Currency>INR</Currency>
<vcRoomRate>1680/1830/600</vcRoomRate>
<vcRateDescription></vcRateDescription>
</Hotel>
<Hotel>
<vcAssociateCode>HRY</vcAssociateCode>
<vcAssociateName>STAR HOTEL</vcAssociateName>
<vcPlaceCode>DEL</vcPlaceCode>
<vcRoomType>Deluxe Rooms</vcRoomType>
<dtDateFrom>11/11/2008</dtDateFrom>
<dtDateTo>03/31/2009</dtDateTo>
<vcRateType>Special FIT</vcRateType>
<vcCountryValidity>General</vcCountryValidity>
<Currency>INR</Currency>
<vcRoomRate>2535/2685/600</vcRoomRate>
<vcRateDescription></vcRateDescription>
</Hotel>
<Hotel>
<vcAssociateCode>HRY</vcAssociateCode>
<vcAssociateName>STAR HOTEL</vcAssociateName>
<vcPlaceCode>DEL</vcPlaceCode>
<vcRoomType>Super Deluxe Double Rooms</vcRoomType>
<dtDateFrom>11/11/2008</dtDateFrom>
<dtDateTo>03/31/2009</dtDateTo>
<vcRateType>Special FIT</vcRateType>
<vcCountryValidity>General</vcCountryValidity>
<Currency>INR</Currency>
<vcRoomRate>4065/4215/600</vcRoomRate>
<vcRateDescription></vcRateDescription>
</Hotel>
</Hotels>
Answer posted by Support on Dec 18, 2008 01:40
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.