Solved

Filtering data in a DataSet - Datagrid

Posted on 2006-07-03
2
350 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.NET 2008 Publish Error 2 43
Generate Numbers in JQuery file 11 72
How to repeat the data 4 30
VB.Net - BackgroundWorker running multiple 5 46
It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…

735 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