|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
how pass Date vaiable to XPath queryHi,All
I want to pass Date varible value to XPATh query (see code below), it i snot work, can anyone help this out? Thanks. Martin Dim currentDate As Date = CDate("5/29/2006") adoCmd.CommandText = "<Root xmlns:sql=""urn:schemas-microsoft-com:xml-sql"" >" & _ "<sql:xpath-query mapping-schema = schema1.xsd/Node1[ Date ='" & currentDate & "' ] </sql:xpath-query>" & _ " </Root>" I figure out now.
Show quoteHide quote "martin1" wrote: > Hi,All > > > I want to pass Date varible value to XPATh query (see code below), it i snot > work, can anyone help this out? Thanks. Martin > > Dim currentDate As Date = CDate("5/29/2006") > > adoCmd.CommandText = "<Root xmlns:sql=""urn:schemas-microsoft-com:xml-sql"" > >" & _ > "<sql:xpath-query mapping-schema = schema1.xsd/Node1[ Date ='" & > currentDate & "' ] </sql:xpath-query>" & _ > " </Root>" And, for the benefit of the next person(s) who have to do the the same
thing... How??? Regards, Phill W. martin1 wrote: Show quoteHide quote > I figure out now. > > "martin1" wrote: > >> Hi,All >> >> >> I want to pass Date varible value to XPATh query (see code below), it i snot >> work, can anyone help this out? Thanks. Martin >> >> Dim currentDate As Date = CDate("5/29/2006") >> >> adoCmd.CommandText = "<Root xmlns:sql=""urn:schemas-microsoft-com:xml-sql"" >>> " & _ >> "<sql:xpath-query mapping-schema = schema1.xsd/Node1[ Date ='" & >> currentDate & "' ] </sql:xpath-query>" & _ >> " </Root>" convert date to string and then pass by strDate = Date.ToString("yyyy-mm-dd")
Show quoteHide quote "Phill W." wrote: > And, for the benefit of the next person(s) who have to do the the same > thing... > > How??? > > Regards, > Phill W. > > > martin1 wrote: > > I figure out now. > > > > "martin1" wrote: > > > >> Hi,All > >> > >> > >> I want to pass Date varible value to XPATh query (see code below), it i snot > >> work, can anyone help this out? Thanks. Martin > >> > >> Dim currentDate As Date = CDate("5/29/2006") > >> > >> adoCmd.CommandText = "<Root xmlns:sql=""urn:schemas-microsoft-com:xml-sql"" > >>> " & _ > >> "<sql:xpath-query mapping-schema = schema1.xsd/Node1[ Date ='" & > >> currentDate & "' ] </sql:xpath-query>" & _ > >> " </Root>" > Phill W. wrote:
Show quoteHide quote > And, for the benefit of the next person(s) who have to do the the same In that context, look at the ToString method of the DateTime class.> thing... > > How??? > > Regards, > Phill W. > > > martin1 wrote: > > I figure out now. > > > > "martin1" wrote: > > > >> Hi,All > >> > >> > >> I want to pass Date varible value to XPATh query (see code below), it i snot > >> work, can anyone help this out? Thanks. Martin > >> > >> Dim currentDate As Date = CDate("5/29/2006") > >> > >> adoCmd.CommandText = "<Root xmlns:sql=""urn:schemas-microsoft-com:xml-sql"" > >>> " & _ > >> "<sql:xpath-query mapping-schema = schema1.xsd/Node1[ Date ='" & > >> currentDate & "' ] </sql:xpath-query>" & _ > >> " </Root>" You can pass it formatting information like this: currentDate.ToString("yyyyMMdd") => 20061207 Hope this helps Chris
OLEDBCommand vs. SQLCommand
Using XPath Against A Node how to use table in a dataset as data source for combobox? HTML help files cUpdate Custom attribut with reflection Insert key press in text box Re: Which do you prefer? XML File into a SQL table IE toolbar show/hide How can I simulate an onclick event in IE? |
|||||||||||||||||||||||