Solved

DataView Select on Datatable not producing any results

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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

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…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…
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…

828 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