Imports System.Web.Configuration Public Class Lehrerreport Inherits System.Web.UI.Page Private Sub Webreport_InitComplete(sender As Object, e As System.EventArgs) Handles Me.InitComplete End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then Try Dim reportnr As String = WebConfigurationManager.AppSettings("ReportLehrer") Dim dh As New clsDatahandling Dim ds As New DataSet ds = dh.Get_Tabledata("Select * from web_report where id=" + reportnr, False, True) show_report(ds.Tables(0).Rows(0).Item("SQL"), ds.Tables(0).Rows(0).Item("SQLType"), ds.Tables(0).Rows(0).Item("Reportdatei"), ds.Tables(0).Rows(0).Item("Dokumentnr").ToString) show_report(ds.Tables(0).Rows(0).Item("SQL"), ds.Tables(0).Rows(0).Item("SQLType"), ds.Tables(0).Rows(0).Item("Reportdatei"), ds.Tables(0).Rows(0).Item("Dokumentnr").ToString) Me.WebReport1.Visible = True Me.WebReport1.Zoom = 1 Catch End Try 'show_report("Berufsliste", "SP", "Berufsliste.frx") End If End Sub Sub Open_Report(ByVal reportnr As Integer) Dim url As String = Server.MapPath("/default.aspx") Response.Write("") 'HttpContext.Current.Response.Write("") Exit Sub 'Page.ClientScript.RegisterStartupScript(Me.RadTreeView1.GetType.GetType, "New Windows", "window.open('" + url + "','','')", True) Page.ClientScript.RegisterClientScriptBlock(Me.GetType, "New windows", "window.open('" + url + "','baba','')", True) End Sub Sub show_report(ByVal sql As String, ByVal sqltype As String, ByVal filename As String, dokumentnr As String) Try If dokumentnr <> "" Then If dokumentnr <> "-1" Then sql = sql.Replace("%DOKNR%", dokumentnr) End If Dim ds1 As New DataSet Dim ds As New DataSet Dim dh As New clsDatahandling 'ds = dh.Get_Tabledata("Select * from lehrerdaten where lehrernr=" + Session("Lehrer").ToString, False, True) ds = dh.Get_Tabledata("Exec sp_lehrerdaten " + Session("Lehrer").ToString, False, True) 'If sqltype = "SP" Then ' ds = dh.Get_Tabledata(sql, True, False) 'Else ' If sqltype = "SQL" Then ' ds = dh.Get_Tabledata(sql, False, True) ' Else ' ds = dh.Get_Tabledata(sql, False, False) ' End If 'End If Me.WebReport1.Prepare() Me.WebReport1.ReportFile = "~/Reporting/" + filename Me.WebReport1.DataBind() Dim x As FastReport.Report = WebReport1.Report x.RegisterData(ds) Catch ex As Exception End Try End Sub Private Sub WebReport1_StartReport(sender As Object, e As System.EventArgs) Handles WebReport1.StartReport Dim dh As New clsDatahandling Me.WebReport1.Report.SetParameterValue("Parcours", dh.Get_Option(2)) Me.WebReport1.Report.SetParameterValue("Spruch", dh.Get_Option(3)) Me.WebReport1.Report.SetParameterValue("URL", dh.Get_Option(27)) ' Me.WebReport1.Report.SetParameterValue("URL", "..\bilder\reportlogo.jpg") End Sub Protected Sub RadButton1_Click(sender As Object, e As EventArgs) Handles RadButton1.Click Response.Redirect("~/lehrer/schueler.aspx") End Sub 'Protected Sub RadButton2_Click(sender As Object, e As EventArgs) Handles RadButton2.Click ' Me.WebReport1.Prepare() ' Me.WebReport1.Prepare() ' Dim exp As New FastReport.Export.Pdf.PDFExport ' Dim fn As String = Server.MapPath("~/Reporting/") + System.IO.Path.GetRandomFileName + ".pdf" ' Me.WebReport1.Report.Export(exp, fn) ' Dim downloadfile As New System.IO.FileInfo(fn) ' HttpContext.Current.Response.Clear() ' HttpContext.Current.Response.AddHeader("Content-Disposition", String.Format("attachment; filename={0}", downloadfile.Name)) ' HttpContext.Current.Response.AddHeader("Content-Length", downloadfile.Length.ToString()) ' HttpContext.Current.Response.ContentType = "application/octet-stream" ' HttpContext.Current.Response.WriteFile(downloadfile.FullName) ' HttpContext.Current.Response.End() 'End Sub End Class