?
Solved

DataView Select on Datatable not producing any results

Posted on 2008-10-20
1
Medium Priority
?
886 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 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

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.
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…
Suggested Courses

770 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