473,411 Members | 2,272 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,411 software developers and data experts.

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

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=my dbase;"
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.Clo seConnection)
thedata2.DataBind()
end sub
''''''''

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

Nov 19 '05 #1
1 1656
On Fri, 24 Jun 2005 13:28:09 -0700, .Net Sports wrote:
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=my dbase;"
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.Clo seConnection)
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.Clo seConnection)
' The date is in articleDate in your data reader as
(string)DR("articleDate")

You can compare with Now.
.NetSports


Nov 19 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Gerrit Holl | last post by:
Posted with permission from the author. I have some comments on this PEP, see the (coming) followup to this message. PEP: 321 Title: Date/Time Parsing and Formatting Version: $Revision: 1.3 $...
9
by: Thomas W | last post by:
I'm developing a web-application where the user sometimes has to enter dates in plain text, allthough a format may be provided to give clues. On the server side this piece of text has to be parsed...
4
by: silviu | last post by:
I have the following XML string that I want to parse using the SAX parser. If I remove the portion of the XML string between the <audit> and </audit> tags the SAX is parsing correctly. Otherwise...
21
by: Javier | last post by:
Hi I´ve a routine that will read date and times in a vector of strings ie: 30/02/2005 19:20 In some moment I´ll need to check if there are in vector a date like current date with a time...
3
by: Neil Ginsberg | last post by:
I need to write some code that will get all filenames under a particular directory and add them to a table, including any in subdirectories. I realize that Dir can be used to get all filenames in a...
0
by: Brian Conway | last post by:
I am having some validation and insertion problems. I am using a date picker that takes the selected date and puts it to ("dd-MMM-yyyy") format, as this was the only format that Oracle would...
1
by: .Net Sports | last post by:
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...
7
by: M | last post by:
Hi, I need to parse text files to extract data records. The files will consist of a header, zero or more data records, and a trailer. I can discard the header and trailer but I must split the...
5
by: Kermit Piper | last post by:
Hello, I am comparing two date values, one from a database and one that has been converted from a hard-coded string into an actual Date type. So far so good. The problem I'm having is that one...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.