This code shows how to create Reports using ASP.NET Crystal Reports
Imports System Imports System.Data Imports System.Data.OleDb
Partial Class _Default Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim ConnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\vb.net projects\dept_mstr.mdb" Dim myConnection As OleDbConnection = New OleDbConnection myConnection.ConnectionString = ConnString
Dim ds As New DataSet Dim da As New OleDbDataAdapter Dim sql As String = "select distinct dept_no,dept_name from DEPARTMENT" myConnection.Open()
Dim com As New OleDbCommand Dim dbread com = New OleDbCommand(sql, myConnection) dbread = com.ExecuteReader While dbread.read DropDownList1.Items.Add(dbread.getVALUE(0)) DropDownList2.Items.Add(dbread.getstring(1)) End While
End Sub
Protected Sub CrystalReportViewer1_Init(ByVal sender As Object, ByVal e As System.EventArgs) Handles CrystalReportViewer1.Init
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click Dim Fltr CrystalReportViewer1.ReportSource = "E:\WebSite2\crystalreport1.rpt" Fltr = "{DEPARTMENT.dept_no}='" & Me.DropDownList1.Text & "' and '" & Me.DropDownList2.Text & "'" CrystalReportViewer1.SelectionFormula = (Fltr) End Sub End Class
|
No responses found. Be the first to respond and make money from revenue sharing program.
|