Solved

DataView Select on Datatable not producing any results

Posted on 2008-10-20
1
876 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

943 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

Need Help in Real-Time?

Connect with top rated Experts

5 Experts available now in Live!

Get 1:1 Help Now