With ASP.NET, you can set up a Web Service that returns a dataset to use for an ActiveReport. This walkthrough illustrates how to create one.
This walkthrough is split up into the following activities:
To complete the walkthrough, you must have access to the Northwind database.
A copy is located at C:\Program Files\GrapeCity\ActiveReports 6\Data\NWIND.MDB (on a 64-bit Windows operating system, a copy is located in C:\Program Files (x86)\GrapeCity\ActiveReports 6\Data\NWIND.MDB).
In the App_Code/Service.vb or Service.cs file that displays by default, replace the existing <WebMethod()> _ and HelloWorld function with code like the following.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste OVER the existing WebMethod. |
Copy Code |
---|---|
Private connString As String <WebMethod(Description:="Returns a DataSet containing all Products")> _ Public Function GetProduct() As Data.DataSet connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\GrapeCity\ActiveReports 6\Data\nwind.mdb" Dim adapter As New Data.OleDb.OleDbDataAdapter("select * from products", connString) Dim ds As New Data.DataSet() adapter.Fill(ds, "Products") Return ds End Function |
To write the code in C#
C# code. Paste OVER the existing WebMethod. |
Copy Code |
---|---|
private static string connString = "Provider=Microsoft.Jet.OLEDB.4.0;C:\Program Files\GrapeCity\ActiveReports 6\Data\nwind.mdb"; [WebMethod(Description="Returns a DataSet containing all Products")] public Data.DataSet GetProduct() { Data.OleDb.OleDbDataAdapter adapter; Data.DataSet ds; adapter = new Data.OleDb.OleDbDataAdapter("select * from products", connString); ds = new Data.DataSet(); adapter.Fill(ds, "Products"); return ds; } |
In the Add Application dialog box that appears, enter the following information:
Alias: enter a name for the virtual directory.
Physical path: select the folder that contains your Web service folder.
Important: In order to consume Web services in your Windows applications, you must set permissions to allow the ASP.NET user to consume the services. Ask your server administrator for help with this. |
For information on consuming the DataSet Web Service in an ActiveReport, see DataSet Windows Application.