Parsing date from sql string in asp.net, then comparing it with present date

N

.Net Sports

I need to parse the date I'm getting from this sqlstring to compare it
with today's date. If it's before today's date, i need to show the
viewers one page. If it is after today's date, then I need to show
viewers another page.
''''''''
Dim strConn2 as string
="SERVER=xxx.xx.xx.x;UID=xxxx;PWD=xxxx;DATABASE=mydbase;"
Dim strSQL2 as string ="SELECT articledate,articleheader,articleID
FROM media WHERE author = 99 AND articledate =(SELECT MAX(articledate)
FROM media WHERE handid = 99)"
Dim Conn2 as New SQLConnection(strConn2)
Dim Cmd2 as New SQLCommand(strSQL2,Conn2)
Conn2.Open()
thedata2.DataSource =
Cmd2.ExecuteReader(system.data.CommandBehavior.CloseConnection)
thedata2.DataBind()
end sub
''''''''

but I'm stuck as how to use the articledate from this resultset for the
comparison.
??????
..NetSports
 
I

intrader

I need to parse the date I'm getting from this sqlstring to compare it
with today's date. If it's before today's date, i need to show the
viewers one page. If it is after today's date, then I need to show
viewers another page.
''''''''
Dim strConn2 as string
="SERVER=xxx.xx.xx.x;UID=xxxx;PWD=xxxx;DATABASE=mydbase;"
Dim strSQL2 as string ="SELECT articledate,articleheader,articleID
FROM media WHERE author = 99 AND articledate =(SELECT MAX(articledate)
FROM media WHERE handid = 99)"
Dim Conn2 as New SQLConnection(strConn2)
Dim Cmd2 as New SQLCommand(strSQL2,Conn2)
Conn2.Open()
thedata2.DataSource =
Cmd2.ExecuteReader(system.data.CommandBehavior.CloseConnection)
thedata2.DataBind()
end sub
''''''''

but I'm stuck as how to use the articledate from this resultset for the
comparison.
??????
I would have:
Dim DR as SqlDataReader
DR = Cmd2.ExecuteReader(system.data.CommandBehavior.CloseConnection)
' The date is in articleDate in your data reader as
(string)DR("articleDate")

You can compare with Now.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top