473,503 Members | 1,666 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Connecting Crystal Reports to DB2

C# .NET 2.0 - Crystal Reports XI

I am trying to connect Crystal Report to DB2 database from my C#
application. After I run the connection info code and try to export the
report I get

{"Database logon failed."} System.Exception
{CrystalDecisions.CrystalReports.Engine.LogOnExcep tion}
I am using the following code to connect:

Database crDatabase;
Tables crTables;
TableLogOnInfo crTableLogOnInfo;
ReportDocument crSubreportDocument;
Sections crSections;
SubreportObject crSubreportObject;
ReportObjects crReportObjects;

ConnectionInfo crConnectioninfo = new ConnectionInfo();

crConnectioninfo.ServerName = "DNS=MyDB2Server"; // or this
crConnectioninfo.ServerName = "MyDB2Server";
crConnectioninfo.UserID = "TestUser";
crConnectioninfo.Password = "TestPassword";
crConnectioninfo.DatabaseName = "MyDB2Database";

//set up the database and tables objects to refer to the current report
crDatabase = cr.Database;
crTables = crDatabase.Tables;

//loop through all the tables and pass in the connection info
foreach (Table crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectioninfo;

crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
I can connect with no problem when I am using CrystalReports IDE or when I
test my ODBC connection.

Does anyone know what values / format I have to specify to crConnectioninfo
or how to connect Crystal Report to DB2 from C# application?
Thank You
Peter
Feb 15 '06 #1
2 4461
Hi Peter,

Have you tried using the ReportDocument.SetDatabaseLogon() method?

Regards - Octavio
"Peter" <pc*****@nospam.nospam> escribió en el mensaje
news:%2***************@TK2MSFTNGP11.phx.gbl...
C# .NET 2.0 - Crystal Reports XI

I am trying to connect Crystal Report to DB2 database from my C#
application. After I run the connection info code and try to export the
report I get

{"Database logon failed."} System.Exception
{CrystalDecisions.CrystalReports.Engine.LogOnExcep tion}
I am using the following code to connect:

Database crDatabase;
Tables crTables;
TableLogOnInfo crTableLogOnInfo;
ReportDocument crSubreportDocument;
Sections crSections;
SubreportObject crSubreportObject;
ReportObjects crReportObjects;

ConnectionInfo crConnectioninfo = new ConnectionInfo();

crConnectioninfo.ServerName = "DNS=MyDB2Server"; // or this
crConnectioninfo.ServerName = "MyDB2Server";
crConnectioninfo.UserID = "TestUser";
crConnectioninfo.Password = "TestPassword";
crConnectioninfo.DatabaseName = "MyDB2Database";

//set up the database and tables objects to refer to the current report
crDatabase = cr.Database;
crTables = crDatabase.Tables;

//loop through all the tables and pass in the connection info
foreach (Table crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectioninfo;

crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
I can connect with no problem when I am using CrystalReports IDE or when I
test my ODBC connection.

Does anyone know what values / format I have to specify to
crConnectioninfo or how to connect Crystal Report to DB2 from C#
application?
Thank You
Peter

Feb 15 '06 #2
Hi Peter,

Thanks for posting!

For the current issue, I'm sorry that Microsoft only supports the setup
issue of the Crystal Report, other supports will be provide by Crystal
Decisions. The KB article shows more details as below:
http://support.microsoft.com/default...b;EN-US;317789

In addition, I find an article from Crystal Decisions demonstrates how to
connect the database at runtime in VB.NET:
http://support.businessobjects.com/l...s/c2010371.asp

I hope this will be helpful. I appreciate your understanding!

Regards,

Yuan Ren [MSFT]
Microsoft Online Support

Feb 15 '06 #3

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

Similar topics

3
6884
by: Gheaci Maschl | last post by:
Hi all! I would like to have your opinion about my problem and my proposal how to solve it: Ingredients: - BTriev database - Crystal Reports - maybe MS Access - Liinos6 (small ERP software)
7
4978
by: p | last post by:
WE had a Crystal 8 WebApp using vs 2002 which we upgraded to VS2003. I also have Crystal 9 pro on my development machine. The web app runs fine on my dev machine but am having problems deploying....
3
8908
by: VMI | last post by:
I know this may not be the best NG for this, but I feel you guys know more about this than any of the other NGs. I need to build several simple reports (over 50 of them and they get their data...
0
2127
by: Swaroop Bhattacharyya | last post by:
I want to access IBM DB2 CLP from Crystal Reports.This is for schedueling a job in Crystal Reports. How will i link the Crystal Reports and the IBM DB2 CLP ?
1
1600
by: mahesh123 | last post by:
Hi Folks, I am using the crystal reports 8.0 with VB6.0 and database is MSAccess. When i am connecting to the database through DAO, then i am getting an error DAO.Workspace Not a Valid...
2
19471
by: rathnaravi | last post by:
I am using NetBeans 5.0.I tried to connect MySQL with Crystal Reports XI.When writing the coding in Java Application.I get the following error....
7
4390
by: Mohammed Seidu | last post by:
Hi all, Can anyone help me on how to create crystal reports in a .net windows application? The problem is, i have an OleDbConnection object named 'conn' which I create dynamically to connect to...
3
3797
by: Miro | last post by:
Hi, Just wondering what a good book is on visual studios 2008 ( or 2005 if no 2008 ) that teaches you how to properly use crystal reports with it. Or im assuming that as long as I can create a...
1
8118
by: =?Utf-8?B?Q2lhcmFuIE8nJ0Rvbm5lbGw=?= | last post by:
On reflection, you could possibly make the app a self extracting zip file which extracts the EXE and a settings file and then starts the app, then when you app closes, it can repack the settings...
0
7203
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
7087
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
7281
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7334
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
7462
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...
0
5579
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4675
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3156
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1514
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.