473,372 Members | 1,029 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,372 software developers and data experts.

LogOn error with Crystal Report

Hi all,

It's my first post here, so be kind :)

I got a little application that keep track of a small inventory, everything was going great until came the time to make some types of reports. I want to use Crystal Reports in the background to generate the reports for me, i don't want any preview, any popup (only a print dialog then send it to the selected printer). That should be pretty easy ;)

First of all, my app doesnt make any use of dataset nor dataadapter. When i retreive the data from my DB i received a collection of items (ArrayList), which, i convert back to a special dataset(only 1 table) i've created, which is bind to my CR report. Which seem to be ok, since i've managed to draw the report.

Here's the offending code ;)

ArrayList arrCuts = Data.FacadeData.Instance.GetCut(infosWireCuts);
DataCuts dataCuts = new DataCuts(); <= Creation of the temporary DS

foreach (Data.InfosWireCuts wireCut in arrCuts)
{
DataCuts.WireCutsRow rowCut= dataCuts.WireCuts.NewCutRow();

rowCut.NoCut = wireCut.NoCut;
...
(converting my arraylist into a dataset)
...

dataCuts.WireCuts.AddCutRow(rowCut);
}

InventoryReport report = new InventoryReport ();
report.PrintToPrinter(1, false, 0, 0); <= The exception is throw in here

The exception thrown is of type: CrystalDecisions.CrystalReports.Engine.LogOnExcept ion, which is a little dumb since i'm using a dataset.

If anyone have ideas or suggestions, plz tell me, it would be really apprecited...

Thx in Advance
Jonathan
Jul 22 '05 #1
2 2319
Hi Jonathan,

There are several articles on this issue at the businessobjects.com website. Basically, what you want to do requires the establishment of logon info. (With earlier versions of CR you didn't have to do this - versions, I believe, before version X). In any case, here's the code I use for every report I run; it differs a bit from what you will do because I use the cr viewer almost exclusively, but the principle is very much the same:
Public Sub connectionchange()

Dim crtablelogoninfos As New TableLogOnInfos

Dim crtablelogoninfo As New TableLogOnInfo

Dim crconnectioninfo As New ConnectionInfo

Dim crtables As Tables

Dim crtable As Table

Dim tablecounter As Integer

crreportdocument.Load(gl_browseprintvar, OpenReportMethod.OpenReportByTempCopy)

With crconnectioninfo

..DatabaseName = "IMC"

..ServerName = globalservername

..UserID = globalusername

..Password = globalpwd

End With

crtablelogoninfo.ConnectionInfo = crconnectioninfo

crtables = crreportdocument.Database.Tables

For Each crtable In crtables

'///

If (Mid(crtable.Name, 1, 4) = "magt" Or Mid(crtable.Name, 1, 23) = "sp_createmagtbaseselect" Or Mid(crtable.Name, 1, 4) = "magb" Or Mid(crtable.Name, 1, 4) = "magf") And gl_browseprintvar = "f:\imcapps\hvsum.rpt" Then

crconnectioninfo.DatabaseName = "imc_extra"

crtablelogoninfo.ConnectionInfo = crconnectioninfo

Else

crconnectioninfo.DatabaseName = "IMC"

crtablelogoninfo.ConnectionInfo = crconnectioninfo

End If

'///

' crtablelogoninfo = crtable.LogOnInfo

' crtable.LogOnInfo.ConnectionInfo = crconnectioninfo

crtable.ApplyLogOnInfo(crtablelogoninfo)

crtable.Location = crtable.Name

'MessageBox.Show(crconnectioninfo.ServerName)

'MessageBox.Show(crtable.LogOnInfo.ConnectionInfo. ServerName)

Next

Dim subRepDoc As New ReportDocument

Dim crSection As Section

Dim crReportObject As ReportObject

Dim crSubreportObject As SubreportObject

'If you have any sub-reports, they need the connection info too...

For Each crSection In crreportdocument.ReportDefinition.Sections

For Each crReportObject In crSection.ReportObjects

If crReportObject.Kind = ReportObjectKind.SubreportObject Then

crSubreportObject = CType(crReportObject, SubreportObject)

subRepDoc = crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)

For Each crtable In subRepDoc.Database.Tables

crtable.ApplyLogOnInfo(crtablelogoninfo)

crtable.Location = crtable.Name

Next

End If

Next

Next

'If CrystalReportViewer1.ParameterFieldInfo.Count > 0 Then

' CrystalReportViewer1.ShowRefreshButton = False

'End If

CrystalReportViewer1.ReportSource = crreportdocument

End Sub

HTH,

Bernie Yaeger

"Jonathan" <jb******@britton.ca> wrote in message news:eT**************@TK2MSFTNGP10.phx.gbl...
Hi all,

It's my first post here, so be kind :)

I got a little application that keep track of a small inventory, everything was going great until came the time to make some types of reports. I want to use Crystal Reports in the background to generate the reports for me, i don't want any preview, any popup (only a print dialog then send it to the selected printer). That should be pretty easy ;)

First of all, my app doesnt make any use of dataset nor dataadapter. When i retreive the data from my DB i received a collection of items (ArrayList), which, i convert back to a special dataset(only 1 table) i've created, which is bind to my CR report. Which seem to be ok, since i've managed to draw the report.

Here's the offending code ;)

ArrayList arrCuts = Data.FacadeData.Instance.GetCut(infosWireCuts);
DataCuts dataCuts = new DataCuts(); <= Creation of the temporary DS

foreach (Data.InfosWireCuts wireCut in arrCuts)
{
DataCuts.WireCutsRow rowCut= dataCuts.WireCuts.NewCutRow();

rowCut.NoCut = wireCut.NoCut;
...
(converting my arraylist into a dataset)
...

dataCuts.WireCuts.AddCutRow(rowCut);
}

InventoryReport report = new InventoryReport ();
report.PrintToPrinter(1, false, 0, 0); <= The exception is throw in here

The exception thrown is of type: CrystalDecisions.CrystalReports.Engine.LogOnExcept ion, which is a little dumb since i'm using a dataset.

If anyone have ideas or suggestions, plz tell me, it would be really apprecited...

Thx in Advance
Jonathan
Jul 22 '05 #2
Thanks you for your response... i've google around on the web before posting here... but everytime i found an page about this exception they were really accessing a sql or oracle database.

I'll try to fool around with your post, i'm pretty sure it gonna be helpful

Jonathan
"Bernie Yaeger" <be*****@cherwellinc.com> wrote in message news:eD**************@TK2MSFTNGP12.phx.gbl...
Hi Jonathan,

There are several articles on this issue at the businessobjects.com website. Basically, what you want to do requires the establishment of logon info. (With earlier versions of CR you didn't have to do this - versions, I believe, before version X). In any case, here's the code I use for every report I run; it differs a bit from what you will do because I use the cr viewer almost exclusively, but the principle is very much the same:
Public Sub connectionchange()

Dim crtablelogoninfos As New TableLogOnInfos

Dim crtablelogoninfo As New TableLogOnInfo

Dim crconnectioninfo As New ConnectionInfo

Dim crtables As Tables

Dim crtable As Table

Dim tablecounter As Integer

crreportdocument.Load(gl_browseprintvar, OpenReportMethod.OpenReportByTempCopy)

With crconnectioninfo

.DatabaseName = "IMC"

.ServerName = globalservername

.UserID = globalusername

.Password = globalpwd

End With

crtablelogoninfo.ConnectionInfo = crconnectioninfo

crtables = crreportdocument.Database.Tables

For Each crtable In crtables

'///

If (Mid(crtable.Name, 1, 4) = "magt" Or Mid(crtable.Name, 1, 23) = "sp_createmagtbaseselect" Or Mid(crtable.Name, 1, 4) = "magb" Or Mid(crtable.Name, 1, 4) = "magf") And gl_browseprintvar = "f:\imcapps\hvsum.rpt" Then

crconnectioninfo.DatabaseName = "imc_extra"

crtablelogoninfo.ConnectionInfo = crconnectioninfo

Else

crconnectioninfo.DatabaseName = "IMC"

crtablelogoninfo.ConnectionInfo = crconnectioninfo

End If

'///

' crtablelogoninfo = crtable.LogOnInfo

' crtable.LogOnInfo.ConnectionInfo = crconnectioninfo

crtable.ApplyLogOnInfo(crtablelogoninfo)

crtable.Location = crtable.Name

'MessageBox.Show(crconnectioninfo.ServerName)

'MessageBox.Show(crtable.LogOnInfo.ConnectionInfo. ServerName)

Next

Dim subRepDoc As New ReportDocument

Dim crSection As Section

Dim crReportObject As ReportObject

Dim crSubreportObject As SubreportObject

'If you have any sub-reports, they need the connection info too...

For Each crSection In crreportdocument.ReportDefinition.Sections

For Each crReportObject In crSection.ReportObjects

If crReportObject.Kind = ReportObjectKind.SubreportObject Then

crSubreportObject = CType(crReportObject, SubreportObject)

subRepDoc = crSubreportObject.OpenSubreport(crSubreportObject. SubreportName)

For Each crtable In subRepDoc.Database.Tables

crtable.ApplyLogOnInfo(crtablelogoninfo)

crtable.Location = crtable.Name

Next

End If

Next

Next

'If CrystalReportViewer1.ParameterFieldInfo.Count > 0 Then

' CrystalReportViewer1.ShowRefreshButton = False

'End If

CrystalReportViewer1.ReportSource = crreportdocument

End Sub

HTH,

Bernie Yaeger

"Jonathan" <jb******@britton.ca> wrote in message news:eT**************@TK2MSFTNGP10.phx.gbl...
Hi all,

It's my first post here, so be kind :)

I got a little application that keep track of a small inventory, everything was going great until came the time to make some types of reports. I want to use Crystal Reports in the background to generate the reports for me, i don't want any preview, any popup (only a print dialog then send it to the selected printer). That should be pretty easy ;)

First of all, my app doesnt make any use of dataset nor dataadapter. When i retreive the data from my DB i received a collection of items (ArrayList), which, i convert back to a special dataset(only 1 table) i've created, which is bind to my CR report. Which seem to be ok, since i've managed to draw the report.

Here's the offending code ;)

ArrayList arrCuts = Data.FacadeData.Instance.GetCut(infosWireCuts);
DataCuts dataCuts = new DataCuts(); <= Creation of the temporary DS

foreach (Data.InfosWireCuts wireCut in arrCuts)
{
DataCuts.WireCutsRow rowCut= dataCuts.WireCuts.NewCutRow();

rowCut.NoCut = wireCut.NoCut;
...
(converting my arraylist into a dataset)
...

dataCuts.WireCuts.AddCutRow(rowCut);
}

InventoryReport report = new InventoryReport ();
report.PrintToPrinter(1, false, 0, 0); <= The exception is throw in here

The exception thrown is of type: CrystalDecisions.CrystalReports.Engine.LogOnExcept ion, which is a little dumb since i'm using a dataset.

If anyone have ideas or suggestions, plz tell me, it would be really apprecited...

Thx in Advance
Jonathan
Jul 22 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ambika Srinivasan | last post by:
Hi, I am getting the following error running a crystal report with VB.NET Exception Details: CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed. Source Error:
1
by: Bob Skutnick | last post by:
Help.... I've created an ADO.NET dataset in Visual Studio (a web project). I build the project and then try to create a Crystal Report using the dataset. When I try to use the ADO.NET dataset...
0
by: Max | last post by:
Hi wise people, Has anyone encountered the Crystal Reports problem I describe below? If so, how did you solve it? It seems that every article posted on google regarding CR and logon problems is...
0
by: Das | last post by:
Hi everyone, I have been using crystal report with visual basic 6. I know with crystal report & sql server, if there is a different server name than the one you created report. It prompts as...
2
by: Karun Karunakaran | last post by:
Hi, I am using the Crystal Enterprise .NET assemblies to generate and display a crystal report in a webform. This report connects to an SQL server (running locally) using a specific username and...
3
by: Milan Todorovic | last post by:
Hello, I need help. I have experience in ASP.NET programming, but this is my first dealing with Crystal Reports. I'm trying to make the most basic report purely for testing purposes: connect to...
19
by: Michael O'Donnell | last post by:
Hi All Am having major problem with crystal reports...Have designed my report no problem, its when I try to run and display ther report that I am getting a "Login Failed" message. At first I...
3
by: Hugh O | last post by:
Hi, I have been trying to load a Crystal Report newly created via VS.Net 2003. I am using a simply ASP form with only the Crystal Report Viewer. The sample report results display in the...
1
by: vipindev.s | last post by:
hi all i am not much expert in asp.net. i am using crystal rpt for report generation. is any other report generation method is available??? i use push method to creat report, and it is working...
0
by: bonita | last post by:
I come across the error "CrystalDecisions.CrystalReports.Engine.LogOnException: Logon failed." After I move my asp.net code from the development platform (XP professional) to the production web...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.