|
|
 |
| Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Crystal Reports section of the Wrox p2p Programmer to Programmer discussion community. This is a community of more than 40,000 computer programmers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining our free Wrox p2p community you can post your own programming questions and respond to other programmers’ questions. Registered users also don't have to see the ads that are displayed to guests. Registration is fast, simple and absolutely free so please, join today!
Join today and post to win prizes! Post more to increase your chances of being Wrox’s top poster of the month.
|
 |

April 21st, 2004, 07:02 AM
|
|
Friend of Wrox
|
|
Join Date: Jul 2003
Location: York, , United Kingdom.
Posts: 142
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Database logon problem with Crystal Report
I'm delivering a crystal report through an asp.net page, using the crystal report viewer. When testing on my machine, everything works ok, however when the page is loaded on any other machine the user is prompted to logon to the database.
I'm confused about this because I did have this problem on my own machine until I put the following line in to the setup code;
Code:
rpt.SetDatabaseLogon("dbLogon", "password")
(where rpt is the crystal report being used)
How do I overcome this problem; i.e. get the report to load without the user being prompted to log on to the database? The crystal report is one I developed outside of visual studio and then added to a project, so it sets up all it's own connections, etc. I'm using CR10
|

April 21st, 2004, 08:00 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Location: Tehran, Iran
Posts: 922
Thanks: 0
Thanked 1 Time in 1 Post
|
|
Plz take a look at http://p2p.wrox.com/topic.asp?TOPIC_ID=6389
u should login for every table u use in ur rpt file.
actually, im not sure about that & I'll be glad if there r better ways. (This was what I got from a sample in net & hope its the right way)
Always:),
Hovik Melkomian.
|

April 29th, 2004, 01:37 PM
|
|
Registered User
|
|
Join Date: Apr 2004
Location: Dayton, Ohio, USA.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
You can create a File DSN for an ODBC connection, edit the file in notepad to add the password, and use this File DSN as you datasource.
jakemm
|

June 7th, 2004, 12:59 AM
|
|
Registered User
|
|
Join Date: Jun 2004
Location: CHANDIGARH, chandigarh, India.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
use this code in crystalReportViewer.
//Create the ConnectionInfos object to store the database logon Information
ConnectionInfos connInfos = new ConnectionInfos();
//Create a ConnectionInfo object for each database logon you want to set.
IConnectionInfo connInfo1 = new ConnectionInfo();
//Set the database logon information for each ConnectionInfo object.
connInfo1.setUserName("Scott");
connInfo1.setPassword("Tiger");
//Add each ConnectionInfo object to the ConnectionInfos collection.
//The ConnectionInfos object can now be used to set the database logon information for a report.
connInfos.add(connInfo1);
//Set the database logon information by passing the viewer the initialized ConnectionInfos object.
viewer.setDatabaseLogonInfos(connInfos);
viewer.setEnableLogonPrompt(false);
|

June 24th, 2004, 05:23 AM
|
|
Registered User
|
|
Join Date: Jun 2004
Location: , , France.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Hi!
I've big problems with reports and data source.
1- I create a IConnectionInfo, with all properties I want.
2- my piece of code :
Code:
viewer.setReportSource(reportSource);
ConnectionInfos connInfos = viewer.getDatabaseLogonInfos();
connInfos.clear(); //I voluntarily delete all connection info associated
//with the report (at the design time).
System.out.println(connInfo.getAttributes().toString());
//It prints everything OK, with all the parameters I defined in my IConnectionInfo :)
connInfos.add(connInfo); //Add my IConnectionInfo to the collection
//Here comes the trouble...
viewer.setDatabaseLogonInfos(connInfos);
System.out.println(viewer.getDatabaseLogonInfos().getConnectionInfo(0).getAttributes().toString());
//Now it prints the infos that will be used for display.
//I hoped my changes infos, and I get the design-time infos !!!! :(
//So baaaad !
//and then viewer.refresh(), processHttpRequest() and dispose()...
I followed the tutorials/examples in the PDF "CR for JBuilder"... but nothing better happen :(
The collection connInfos is OK, cleared and then have my changed settings, but the view.setDatabaseLogonInfos doesn't work.
The System.err prints on setDatabaseLogonInfos. (I printed some ##### marks just before and after the instruction, and between them, there is nothing.
I'm really desperate! I really need to change the database logon informations because I've several databases and I want to use the same report.
|

October 25th, 2004, 03:32 AM
|
|
Registered User
|
|
Join Date: Jun 2004
Location: , , France.
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I just tried with a new version.
That's not better :(
|

September 25th, 2009, 12:39 PM
|
|
Registered User
|
|
Join Date: Sep 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Not able to login to the crystal report
Hi, I am facing issue with the crystal report with dynamic databases.
Please let me brief the context here.
I have some crystal reprots (8.5) which uses ODBC to run. I am using the .Net winform to call each report. The server, database, user id and passwords are passed dynamically. But, some of the reports are failing to execute and say ".. Table not found .." error. To set the logon, I use the following code.
reportDoc.SetDatabaseLogon(userName, password, database, database);
foreach (IConnectionInfo conInfo in reportDoc.DataSourceConnections)
{
conInfo.SetConnection(serverName, database, userName, password);
}
foreach (CrystalDecisions.CrystalReports.Engine.Table table in reportDoc.Database.Tables)
{
TableLogOnInfo logOnInfo = table.LogOnInfo;
if (logOnInfo != null)
{
logOnInfo.TableName = table.Name;
logOnInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(logOnInfo);
table.Location = string.Format("{0}.dbo.{1}", database, table.Location.Substring(table.Location.LastIndexO f(".") + 1));
}
}
// Set subreport connection info
foreach (ReportDocument subreport in reportDoc.Subreports)
{
foreach (IConnectionInfo conInfo in reportDoc.DataSourceConnections)
{
conInfo.SetConnection(serverName, database, userName, password);
}
foreach (Table table in subreport.Database.Tables)
{
TableLogOnInfo logOnInfo = table.LogOnInfo;
if (logOnInfo != null)
{
logOnInfo.TableName = table.Name;
logOnInfo.ConnectionInfo = connectionInfo;
table.ApplyLogOnInfo(logOnInfo);
table.Location = string.Format("{0}.dbo.{1}", database, table.Location.Substring(table.Location.LastIndexO f(".") + 1));
}
}
}
But, even after setting this, some reports didnot executed. But i found a weired issue while debugging the code. The logon connection info is the default database set while developing the report, but while setting the connection, the database is set to "master"!!! This happens only for some of the reports. So i dont think this is a code issue.
Can anyone help on this?
Shyju
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
 |