Solved

DataView Select on Datatable not producing any results

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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Visual Studio npm 1 29
UDP Data Capture Thread Issue 7 31
Stop Git from being my repository 1 26
Broken .resx file generating errors 18 26
Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

730 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