nwindConn.CreateCommand();
catCMD.CommandText = "SELECT CategoryID, CategoryName FROM Categories WHERE CategoryName LIKE ‘B%’ ORDER BY 1“;
nwindConn.Open();
SqlDataReader myReader = catCMD.ExecuteReader();
while (myReader.Read())
{
Console.WriteLine("\t{0}\t{1}", myReader.GetInt32(0), myReader.GetString(1));
}
myReader.Close();
nwindConn.Close();
DataSet DS=new DataSet();
XQueryNavigatorCollection oXQ = new XQueryNavigatorCollection();
string strXML = "";
string fileName1="c:\\Test\\T1.xml";
string alias1 = "MyDataTest.xml";
oXQ.AddNavigator( fileName1, alias1 );
string strQuery = " { " +
" let $bb := document(\"MyDataTest.xml\")/*/* " +
" let $cc := document(\"MyDatattt.xml\")/*/* " +
" for $c in $cc " +
" for $b in $bb " +
" where $c/kod = $b/kod " +
" return { $b/nazv,$b/dat,$c/naim }
" +
" } “ ;
XQueryExpression xExpression = new XQueryExpression(strQuery);
strXML = xExpression.Execute(oXQ).ToXml();
StringReader strReader = new StringReader(strXML);
XmlTextReader reader = new XmlTextReader(strReader);
DS.ReadXml(reader);
DataGrid1.DataSource = DS.Tables[0];
DataGrid1.DataBind();
Dim xmldoc As New System.Xml.XPath.XPathDocument("c:\books.xml")
Dim nav As System.Xml.XPath.XPathNavigator = xmldoc.CreateNavigator()
Dim expr As System.Xml.XPath.XPathExpression = nav.Compile( "//Publisher[. = 'MSPress']/parent::node()/Title" )