By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,136 Members | 2,135 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,136 IT Pros & Developers. It's quick & easy.

Help with crystal reports in ASP.net

P: n/a
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.ReportDocum ent

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.
Nov 19 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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
el********@hotmail.com

-----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 incrystal 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.DiskFileDestinationOption s
With cryRptDestinationOptions
.DiskFileName = (Server.MapPath ("./OCCOrderDetailPDFs/" & strOrderId &".pdf"))
End With
Dim cryRptTheReport As New
CrystalDecisions.CrystalReports.Engine.ReportDocu ment

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.
.

Nov 19 '05 #2

P: n/a
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" wrote:
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
el********@hotmail.com

-----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.DiskFileDestinationOption s
With cryRptDestinationOptions
.DiskFileName = (Server.MapPath

("./OCCOrderDetailPDFs/" & strOrderId &
".pdf"))
End With
Dim cryRptTheReport As New
CrystalDecisions.CrystalReports.Engine.ReportDocu ment

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.
.

Nov 19 '05 #3

P: n/a
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
el********@hotmail.com
-----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" wrote:
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
el********@hotmail.com

>-----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.DiskFileDestinationOption s
>With cryRptDestinationOptions
> .DiskFileName = (Server.MapPath

("./OCCOrderDetailPDFs/" & strOrderId &
>".pdf"))
>End With
>Dim cryRptTheReport As New
>CrystalDecisions.CrystalReports.Engine.ReportDocu ment
>
>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.
>.
>


.

Nov 19 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.