Solved

Filtering data in a DataSet - Datagrid

Posted on 2006-07-03
2
346 Views
Last Modified: 2010-04-23
Hello,
 
This project involves retrieving records out of a database with a Select statement run through a Data Adapter.
 
I have a show list button on the form that will populate the datagrid.  I'm planning on reading all records from the table into the DataSet and then use this button to filter what will actually appear in the DataGrid.

I've added to From Date and To Date so I plan on using a between statement to populate the DataGrid.  

A friend helped me create a function called CreateTableStyle() to format the column headers and the Mapping Names to get right piece of data displayed in this column.

I'm not sure if I add this data filter to the SQL String query from the form or I apply this filter to the DataSet or just the DataGrid.

What's the preferred method?

Thank You,
Jon
0
Comment
Question by:JMO9966
2 Comments
 
LVL 96

Accepted Solution

by:
Bob Learned earned 250 total points
ID: 17033040
Apply a filter to the DataTable.  

Here is an example:
   DataSet1.Tables("Table1").DefaultView.RowFilter = "ID = 5"

Bob
0
 

Author Comment

by:JMO9966
ID: 17033497
Thanks Bob!

Here's what I ended up with for a Date Range Filter, there was another good expample on Expert Exchange.

dsABC.Tables(0).DefaultView.RowFilter = "Check_Date > #" & Date1 & "# AND Check_Date <  #" & Date2 & "#"


Jon
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
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…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

708 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

15 Experts available now in Live!

Get 1:1 Help Now