Hi
How can i check if some value exists in the data reader
How can i do that ? any ideas please .
bninja
0
Newbie Poster
Recommended Answers
Jump to PostIF dataReader.Read() Then If Not IsDBNull(dataReader("dateColumn")) Then Dim dateTest As DateTime ' Test to see if the value in the database is a date If DateTime.TryParse(dataReader("dateColumn"), dateTest) Then If dateTest = DateTime.Now Then ' Do something End If End If END IF End If
Jump to PostThat is true.
However, before you can safely check the value, you need to check if the value exist.
Errors have been known to occur from time to time when storing to a database.
Therefore, first check if value exists. Then check if the value happens to be NULL.
After …
All 7 Replies
kvprajapati
1,826
Posting Genius
Team Colleague
bninja
0
Newbie Poster
Oxiegen
88
Basically an Occasional Poster
Featured Poster
bninja
0
Newbie Poster
kvprajapati
1,826
Posting Genius
Team Colleague
bninja
0
Newbie Poster
Oxiegen
88
Basically an Occasional Poster
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.