By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,524 Members | 1,589 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,524 IT Pros & Developers. It's quick & easy.

Change Report Data Source

P: n/a
I have report based on a datasource (a tableadapter) that supplies names,
street addresses, cities, etc. to be displayed in a report viewer.

Is there a way in code to modify this report to only show the information
for a certain city provided by the user's entry in a text box?
Nov 13 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
If you have a DataSet and aren't doing data binding, you
can use the inherent DataView class to filter the DataSet.

Dim myDataView = New DataView(myDataSet.Tables("Customers"))
myDataView.Filter = "country = 'Germany'"

If you do this, you will have to use the DataView to display
the data on the report, not the DataSet.

If the report is databound, you can insert a binding source
in between the dataset and the report, and use that to
filter the data.

'GetCustomers fills the Customers table in the Dataset
Dim nwData as CustomersDataSet = CustomersDataSet.GetCustomers()
myReport.DataSource = m_CustomersBindingSource
m_CustomersBindingSource.DataSource = nwData.Customers

Then you can apply a filter to the BindingSource like this:

CustomersBindingSource.Filter = "Country = 'Germany'"

Hope that helps.
Robin S.
-------------------

"William LaMartin" <la******@tampabay.rr.comwrote in message
news:OH**************@TK2MSFTNGP02.phx.gbl...
>I have report based on a datasource (a tableadapter) that supplies names,
street addresses, cities, etc. to be displayed in a report viewer.

Is there a way in code to modify this report to only show the information
for a certain city provided by the user's entry in a text box?

Nov 14 '06 #2

P: n/a
Thanks.

"RobinS" <Ro****@NoSpam.yah.nonewrote in message
news:DK******************************@comcast.com. ..
If you have a DataSet and aren't doing data binding, you
can use the inherent DataView class to filter the DataSet.

Dim myDataView = New DataView(myDataSet.Tables("Customers"))
myDataView.Filter = "country = 'Germany'"

If you do this, you will have to use the DataView to display

Nov 14 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.