473,394 Members | 1,739 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,394 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 2321
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: 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
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.