You can use a Web Service that returns a dataset as the data source for your reports in Windows applications. This walkthrough illustrates how to create a Windows client application that uses the dataset Web Service as the data source for an ActiveReports.
This walkthrough builds on the DataSet Web Service walkthrough and is split up into the following activities:
To add a reference to a web service to the project
To add a reference to a web service in Visual Studio that is compatible with .NET Framework 2.0 Web service
To add a reference to a web service in Visual Studio
To set the report data source to the one returned by the Web service
To set the report data source (for Visual Studio compatible with .NET Framework Web service version)
The following example shows what the code for the method looks like.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the ReportStart event |
Copy Code
|
---|---|
Dim ws As New localhost.Service Dim ds As DataSet()= ws.GetProduct() Me.DataSource = ds Me.DataMember = "Products" |
To write the code in C#
C# code. Paste INSIDE the ReportStart event. |
Copy Code
|
---|---|
localhost.DataSetWS ws = new localhost.Service; DataSet ds = ws.GetProduct(); this.DataSource = ds; this.DataMember = "Products"; |
To set the report data source
The following example shows what the code for the method looks like.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the ReportStart event. |
Copy Code
|
---|---|
Dim ws As New ServiceReference1.ServiceSoapClient() Dim ds As DataSet = ws.GetProduct() Me.DataSource = ds Me.DataMember = "Products" |
To write the code in C#
C# code. Paste INSIDE the ReportStart event. |
Copy Code
|
---|---|
ServiceReference1.ServiceSoapClient ws = new ServiceReference1.ServiceSoapClient(); DataSet ds = ws.GetProduct(); this.DataSource = ds; this.DataMember = "Products"; |
To update the app.config file