|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Change Report Data SourceI 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? 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. ------------------- Show quoteHide quote "William LaMartin" <lamar***@tampabay.rr.com> wrote in message news:OH7GYQ0BHHA.4844@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? > Thanks.
Show quoteHide quote "RobinS" <RobinS@NoSpam.yah.none> wrote in message news:DK2dnYXlN8qzt8TYnZ2dnUVZ_oCdnZ2d@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
A Question on Arrays.
System.Timers.Timer, thread synchronization issues DataGridViewCell has lost its DataGridView - How to solve? Insert COM object that has been separated from its underlying RCW... Debugger question Crystal Reports Logon Problem Don't see application events question about variables and subprocedure Problem calling multiple web services |
|||||||||||||||||||||||