|
Imports System.Data
Imports System.Data.SqlClient
Imports CrystalDecisions.CrystalReports.Engine
Partial Class TestCrystal
Inherits System.Web.UI.Page
Protected Sub btnShow_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnShow.Click
Dim rptDoc As New ReportDocument
Dim ds As New dsTestCrystal
'Dim sqlCon As SqlConnection
Dim dt As New DataTable
'dt.TableName = "Crystal Report Example"
'sqlCon = New SqlConnection("server='servername';Initial Catalog='databasename';user id='userid';password='password'")
'Dim da As New SqlDataAdapter("select Stud_Name, Class, Subject, Marks from stud_details", sqlCon)
'da.Fill(dt)
'dt.WriteXmlSchema(Server.MapPath("database.xsd"))
'dt.WriteXml(Server.MapPath("database.xml"))
dt.ReadXmlSchema(Server.MapPath("database.xsd"))
dt.ReadXml(Server.MapPath("database.xml"))
If DropDownList1.SelectedValue = 0 Then
ds.Tables(0).Merge(dt)
rptDoc.Load(Server.MapPath("SimpleCrystal.rpt"))
rptDoc.SetDataSource(ds)
CrystalReportViewer1.ReportSource = rptDoc
ElseIf DropDownList1.SelectedValue = 1 Then
ds.Tables(0).Merge(dt)
rptDoc.Load(Server.MapPath("GroupCrystal.rpt"))
rptDoc.SetDataSource(ds)
CrystalReportViewer1.ReportSource = rptDoc
ElseIf DropDownList1.SelectedValue = 2 Then
ds.Tables(0).Merge(dt)
rptDoc.Load(Server.MapPath("Graph.rpt"))
rptDoc.SetDataSource(ds)
CrystalReportViewer1.ReportSource = rptDoc
ElseIf DropDownList1.SelectedValue = 3 Then
ds.Tables(0).Merge(dt)
rptDoc.Load(Server.MapPath("CrossTab.rpt"))
rptDoc.SetDataSource(ds)
CrystalReportViewer1.ReportSource = rptDoc
ElseIf DropDownList1.SelectedValue = 4 Then
ds.Tables(0).Merge(dt)
rptDoc.Load(Server.MapPath("SubReport.rpt"))
rptDoc.SetDataSource(ds)
CrystalReportViewer1.ReportSource = rptDoc
End If
End Sub
End Class
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.