Leo Widdo

Leo Widdo

  • NA
  • 4
  • 0

Show report directly to PDF from web page by clicking asp button

Oct 29 2008 10:07 PM

My name is Leo. I am a .net programmer and i  still lack of experience in crystal report.

I want to ask a question  about crystal report.I have asp.net code above. Like you can see,  i am using report viewer.

The problem is i don't want using report viewer and, after i click print button in my web page the report directly show in pdf format without showing in viewer.

Can Crystal report do that ?

Thanks for your help.

 

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

Dim ConnInfo As New ConnectionInfo

With ConnInfo

.ServerName = "test"

.DatabaseName = "testreport"

.UserID = "leo"

.Password = "xxx"

End With

Dim rep As New ReportDocument

rep.Load(Server.MapPath("~\Report\PrintSPKDetail.rpt"))

Dim RepTbls As Tables = rep.Database.Tables

For Each RepTbl As Table In RepTbls

Dim RepTblLogonInfo As TableLogOnInfo = RepTbl.LogOnInfo

RepTblLogonInfo.ConnectionInfo = ConnInfo

RepTbl.ApplyLogOnInfo(RepTblLogonInfo)

Next

Dim ParamCurrentValues As New ParameterValues

Dim NoSPKHPM As New ParameterDiscreteValue

NoSPKHPM.Value = "'" + decrypt_data(Request("NoSPKHPM")) + "'"

ParamCurrentValues.Add(NoSPKHPM)

Dim ParamFields As ParameterFieldDefinitions = rep.DataDefinition.ParameterFields

Dim PrNoSPKHPM As ParameterFieldDefinition = ParamFields("no_spkhpm")

PrNoSPKHPM.ApplyCurrentValues(ParamCurrentValues)

Me.CrystalReportViewer1.ReportSource = rep

Me.CrystalReportViewer1.DataBind()

End Sub