Help with crystal reports in ASP.net

G

Guest

I need some help please!
Crystal is driving me nuts.
Heres my code so far, see below.
Problem:
On the .export() line it comes back with error #5 Login failed!

I know the login info is good so why is the bloody thing doing this.
The paths have been checked and are correct.
The crystal Report is a .rpt file. Not one created in the VS.net IDE but in
crystal itself.
It runs fine. It is a SELECT statement against the DB.
I am stuck. Help me get moving again.

<code>
dim str strOrderId as string
strOrderId = "1234"
Dim cryRptDestinationOptions As New
CrystalDecisions.Shared.DiskFileDestinationOptions
With cryRptDestinationOptions
.DiskFileName = (Server.MapPath("./OCCOrderDetailPDFs/" & strOrderId &
".pdf"))
End With
Dim cryRptTheReport As New
CrystalDecisions.CrystalReports.Engine.ReportDocument

With cryRptTheReport
.Load(Server.MapPath("./Reports/FI0002-OccBillDetails.rpt"),
CrystalDecisions.[Shared].OpenReportMethod.OpenReportByDefault)
Dim cryRtpLogintableInfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim MyConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo
With MyConnectionInfo
.ServerName = "Modor"
.DatabaseName = "MountDoom"
.UserID = "Nazgul"
.Password = "OneRing"
End With
Dim T As CrystalDecisions.CrystalReports.Engine.Table
For Each T In .Database.Tables
cryRtpLogintableInfo = T.LogOnInfo
cryRtpLogintableInfo.ConnectionInfo = MyConnectionInfo
T.ApplyLogOnInfo(cryRtpLogintableInfo)
Next
.ExportOptions.ExportDestinationType =
CrystalDecisions.[Shared].ExportDestinationType.DiskFile
.ExportOptions.ExportFormatType =
CrystalDecisions.[Shared].ExportFormatType.PortableDocFormat
.ExportOptions.DestinationOptions = cryRptDestinationOptions
.Export()
End With
</code>
 
E

Elton Wang

If you send your report file to me, I can try to figure
out the problem.

BTW, which CrystalDesions version are you using , 1.0 or
1.1.

Elton Wang
(e-mail address removed)

-----Original Message-----
I need some help please!
Crystal is driving me nuts.
Heres my code so far, see below.
Problem:
On the .export() line it comes back with error #5 Login failed!

I know the login info is good so why is the bloody thing doing this.
The paths have been checked and are correct.
The crystal Report is a .rpt file. Not one created in the VS.net IDE but in
crystal itself.
It runs fine. It is a SELECT statement against the DB.
I am stuck. Help me get moving again.

<code>
dim str strOrderId as string
strOrderId = "1234"
Dim cryRptDestinationOptions As New
CrystalDecisions.Shared.DiskFileDestinationOptions
With cryRptDestinationOptions
.DiskFileName = (Server.MapPath
("./OCCOrderDetailPDFs/" & strOrderId &
".pdf"))
End With
Dim cryRptTheReport As New
CrystalDecisions.CrystalReports.Engine.ReportDocument

With cryRptTheReport
.Load(Server.MapPath("./Reports/FI0002- OccBillDetails.rpt"),
CrystalDecisions.
[Shared].OpenReportMethod.OpenReportByDefault)
Dim cryRtpLogintableInfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim MyConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo
With MyConnectionInfo
.ServerName = "Modor"
.DatabaseName = "MountDoom"
.UserID = "Nazgul"
.Password = "OneRing"
End With
Dim T As CrystalDecisions.CrystalReports.Engine.Table
For Each T In .Database.Tables
cryRtpLogintableInfo = T.LogOnInfo
cryRtpLogintableInfo.ConnectionInfo = MyConnectionInfo
T.ApplyLogOnInfo(cryRtpLogintableInfo)
Next
.ExportOptions.ExportDestinationType =
CrystalDecisions.[Shared].ExportDestinationType.DiskFile
.ExportOptions.ExportFormatType =
CrystalDecisions. [Shared].ExportFormatType.PortableDocFormat
.ExportOptions.DestinationOptions = cryRptDestinationOptions
.Export()
End With
</code>
--
Deasun
Home Site: www.tirnaog.com
Check out: The Code Vault in my forums section.
.
 
G

Guest

Got it to work finally.
1] Had to add report viewer to page and mark the crystal shared dll to copy
local.
Weird thing here is afterwards I could remove them and it still
worked !!!
So not sure what they did in the backgroud to fix it.
2] Also note that only a OLEDB connection worked. No other connection worked
as the pasword refused to be accepted by the objects. Actually they refused
to keep the value. It was allways "".

So it is working but no idea why, :(.
Spent why too much time on this and I am currently burned out on it. Still
would like to know why this happened.

Deasun the tired.
www.tirnaog.com

Elton Wang said:
If you send your report file to me, I can try to figure
out the problem.

BTW, which CrystalDesions version are you using , 1.0 or
1.1.

Elton Wang
(e-mail address removed)

-----Original Message-----
I need some help please!
Crystal is driving me nuts.
Heres my code so far, see below.
Problem:
On the .export() line it comes back with error #5 Login failed!

I know the login info is good so why is the bloody thing doing this.
The paths have been checked and are correct.
The crystal Report is a .rpt file. Not one created in the VS.net IDE but in
crystal itself.
It runs fine. It is a SELECT statement against the DB.
I am stuck. Help me get moving again.

<code>
dim str strOrderId as string
strOrderId = "1234"
Dim cryRptDestinationOptions As New
CrystalDecisions.Shared.DiskFileDestinationOptions
With cryRptDestinationOptions
.DiskFileName = (Server.MapPath
("./OCCOrderDetailPDFs/" & strOrderId &
".pdf"))
End With
Dim cryRptTheReport As New
CrystalDecisions.CrystalReports.Engine.ReportDocument

With cryRptTheReport
.Load(Server.MapPath("./Reports/FI0002- OccBillDetails.rpt"),
CrystalDecisions.
[Shared].OpenReportMethod.OpenReportByDefault)
Dim cryRtpLogintableInfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim MyConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo
With MyConnectionInfo
.ServerName = "Modor"
.DatabaseName = "MountDoom"
.UserID = "Nazgul"
.Password = "OneRing"
End With
Dim T As CrystalDecisions.CrystalReports.Engine.Table
For Each T In .Database.Tables
cryRtpLogintableInfo = T.LogOnInfo
cryRtpLogintableInfo.ConnectionInfo = MyConnectionInfo
T.ApplyLogOnInfo(cryRtpLogintableInfo)
Next
.ExportOptions.ExportDestinationType =
CrystalDecisions.[Shared].ExportDestinationType.DiskFile
.ExportOptions.ExportFormatType =
CrystalDecisions. [Shared].ExportFormatType.PortableDocFormat
.ExportOptions.DestinationOptions = cryRptDestinationOptions
.Export()
End With
</code>
--
Deasun
Home Site: www.tirnaog.com
Check out: The Code Vault in my forums section.
.
 
E

Elton Wang

Hi,

Actually, better way to use Crystal report in .NET is to
add Report to .NET project:

Menu Project à Add Existing Item (Files of types: Crystal
Report(*.rpt)) à pick up report

After that VS.NET will create a class name as reportName
which inherits from
CrystalDecisions.CrystalReports.Engine.ReportClass in
hidden reportName.cs (or reportName.vb) and 3 dll
references:
CrystalDecisions.CrystalReports.Engine
CrystalDecisions.ReportSource
CrystalDecisions.Shared

Then you can use the report as object in the project:
ReportName rpt = new ReportName();

Filling data to report is also very simple:
rpt.Database.Tables(0).SetDataSource(dataTable);
Here dataTable is a DataTable that only requires exactly
the same schema as that in report query.

If no parameter is required, after that the report is
ready for Export() or other command. No any logon info is
required.

Elton Wang
(e-mail address removed)
-----Original Message-----
Got it to work finally.
1] Had to add report viewer to page and mark the crystal shared dll to copy
local.
Weird thing here is afterwards I could remove them and it still
worked !!!
So not sure what they did in the backgroud to fix it.
2] Also note that only a OLEDB connection worked. No other connection worked
as the pasword refused to be accepted by the objects. Actually they refused
to keep the value. It was allways "".

So it is working but no idea why, :(.
Spent why too much time on this and I am currently burned out on it. Still
would like to know why this happened.

Deasun the tired.
www.tirnaog.com

Elton Wang said:
If you send your report file to me, I can try to figure
out the problem.

BTW, which CrystalDesions version are you using , 1.0 or
1.1.

Elton Wang
(e-mail address removed)

-----Original Message-----
I need some help please!
Crystal is driving me nuts.
Heres my code so far, see below.
Problem:
On the .export() line it comes back with error #5 Login failed!

I know the login info is good so why is the bloody
thing
doing this.
The paths have been checked and are correct.
The crystal Report is a .rpt file. Not one created in
the
VS.net IDE but in
crystal itself.
It runs fine. It is a SELECT statement against the DB.
I am stuck. Help me get moving again.

<code>
dim str strOrderId as string
strOrderId = "1234"
Dim cryRptDestinationOptions As New
CrystalDecisions.Shared.DiskFileDestinationOptions
With cryRptDestinationOptions
.DiskFileName = (Server.MapPath
("./OCCOrderDetailPDFs/" & strOrderId &
".pdf"))
End With
Dim cryRptTheReport As New
CrystalDecisions.CrystalReports.Engine.ReportDocument

With cryRptTheReport
.Load(Server.MapPath("./Reports/FI0002- OccBillDetails.rpt"),
CrystalDecisions. [Shared].OpenReportMethod.OpenReportByDefault)
Dim cryRtpLogintableInfo As New CrystalDecisions.Shared.TableLogOnInfo
Dim MyConnectionInfo As New CrystalDecisions.Shared.ConnectionInfo
With MyConnectionInfo
.ServerName = "Modor"
.DatabaseName = "MountDoom"
.UserID = "Nazgul"
.Password = "OneRing"
End With
Dim T As CrystalDecisions.CrystalReports.Engine.Table
For Each T In .Database.Tables
cryRtpLogintableInfo = T.LogOnInfo
cryRtpLogintableInfo.ConnectionInfo = MyConnectionInfo
T.ApplyLogOnInfo(cryRtpLogintableInfo)
Next
.ExportOptions.ExportDestinationType =
CrystalDecisions. [Shared].ExportDestinationType.DiskFile
.ExportOptions.ExportFormatType =
CrystalDecisions. [Shared].ExportFormatType.PortableDocFormat
.ExportOptions.DestinationOptions = cryRptDestinationOptions
.Export()
End With
</code>
--
Deasun
Home Site: www.tirnaog.com
Check out: The Code Vault in my forums section.
.
.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top