Solved

DataView Select on Datatable not producing any results

Posted on 2008-10-20
1
885 Views
Last Modified: 2013-11-08
Hi All,

Can anyone point out what I am doing wrong with my DataTable and DataView? I know that at least one date in the database is greater than or equal to todays date. As it stands the DataView is not returning any rows.
Dim objClasses As New classes
            Dim dt As DataTable = objClasses.getUsersCurrentTrainingRecord(Convert.ToInt32(Request.Cookies("userid").Value))
            Dim filterExpression As String = "startDate >= " & Date.Today.ToString("yyyy-MM-dd")
            Dim dv As New DataView()
 
            dv.RowFilter = filterExpression
 
            gvwCurrentTraining.DataSource = dv
            gvwCurrentTraining.DataBind()

Open in new window

0
Comment
Question by:G0ggy
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 13

Accepted Solution

by:
crazyman earned 500 total points
ID: 22758587
You havent actually applied the filter to the table...
Dim objClasses As New classes
            Dim dt As DataTable = objClasses.getUsersCurrentTrainingRecord(Convert.ToInt32(Request.Cookies("userid").Value))
            Dim filterExpression As String = "startDate >= " & Date.Today.ToString("yyyy-MM-dd")
            Dim dv As New DataView(dt)
 
            dv.RowFilter = filterExpression
 
            gvwCurrentTraining.DataSource = dv
            gvwCurrentTraining.DataBind() 

Open in new window

0

Featured Post

How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question