Using Crystal Report with asp.net(web forms)

gurjinder

New member
Joined
Jul 9, 2003
Messages
2
Location
Delhi
Hi,


I am trying to access crystal report in web forms.

Basically i have worked a lot with vb and crystal report
there we will use crytal engine for that instead of crystal object.
I want same functionality in web forms that means without using
Web form viewer . if there is some way out then please reply soon.
 
Hi,
whats the difference between Crystal engine and Crystal object.

I have generated .pdf and .xls output-files with ASP.net and C#.

Code was like this:
Code:
ReportDocument oRpt = new ReportDocument();
//set the export format
oRpt.Load(ConfigurationSettings.AppSettings["ReportsOnServer"] + Rpt + ".rpt");
if (Extension == "PDF")
{oRpt.ExportOptions.ExportFormatType = ExportFormatType.PortableDocFormat;
}
else
{
oRpt.ExportOptions.ExportFormatType = ExportFormatType.Excel;
}
oRpt.ExportOptions.ExportDestinationType = ExportDestinationType.DiskFile;
.
.
.

Is this what you need? I can send you more code...

Regards,
Stefan
 
hi,

crystal report and report object are same thing here by crystal object i mean ocx control of report.
i have got the output irequired using crytal engine.
there is one problem if anybody help me in that.
I want to pass the complete sql query from front end(vb.net)
using report document object


gurjinder
 
I am having problem with incorporating crystal report in ASPX page. I have to print an invoice and that has to be either through PDF file or through Crystal Report. I am having following problems while extracting the fields from database>>
a) I am using push method for Crystal Report.
b) I created a dataset1.xsd with an existing stored procedure (Steps>>Right Click on Solution>>Add>>new item>>Dataset)
c) When I try to create a report and try to access that Stored procedure that I selected in dataset1.xsd from crystalReport1.rpt (the steps I am taking are right-click on details on CrystalReport1.rpt form >>add/remove database>>Project data etc, etc), I dont see any object there under dataset1.

It seems to me that Crystal Report only works with table object not with the stored procedure (or I am making some mistakes somewhere).

If anybody can help me with a sample piece of code regarding how I can create a crystal report (which will be used in a web page (ex: PrintInvoice.aspx)) using the stored procedure given by our DBA and finally export it to a PDF format (or any printable format from client machine) I will really appreciate that.

Thank all of you in advance.

P.S>>hi webjumper if you can educate me someway to create a pdf file from with in web page I will really apreciate that . I have to create a invoice which I can do it through HTML and then print it with a printable format . My boss like PDF format . SO I have to bring that invoice to PDF format and then give the client ability to print from web browser. Thanks for your help
 
PDF

This is good solution to PDF export report
but I have one question about how transfer from my code one data to the report; for example in windows application crystalreport.formula="mydata"

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim myExportOptions As CrystalDecisions.Shared.ExportOptions
Dim myDiskFilesDestinationOptions As CrystalDecisions.Shared.DiskFileDestinationOptions
Dim myExportFile As String
Dim myReport As New ApplicationRpt()


myExportFile = "C:\temp\PDF " & Session.SessionID.ToString & ".pdf"
myDiskFilesDestinationOptions = New CrystalDecisions.Shared.DiskFileDestinationOptions()
myDiskFilesDestinationOptions.DiskFileName = myExportFile
myExportOptions = myReport.ExportOptions

With myExportOptions
.DestinationOptions = myDiskFilesDestinationOptions
.ExportDestinationType = .ExportDestinationType.DiskFile
.ExportFormatType = .ExportFormatType.PortableDocFormat
End With

myReport.Export()

Response.ClearContent()
Response.ClearHeaders()
Response.ContentType = "application/pdf"
Response.WriteFile(myExportFile)
Response.Flush()
Response.Close()

System.IO.File.Delete(myExportFile)
end sub
 
Back
Top