Solved

DataView Select on Datatable not producing any results

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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
This video discusses moving either the default database or any database to a new volume.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

762 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

22 Experts available now in Live!

Get 1:1 Help Now