on 09-17-2008 2:42 PM
I have a problem that when a report loads a logon prompt appears asking for username and password. I am using Visual Studio 2005 writing a C# winforms program using Crystal Reports XI. The reports are being loaded into the CrystalReportViewer.
The .rpt files were originally designed against our development database and we are changing the database details through the code to use the production database. The database and connections use sql authentication.
The logon prompt only appears on some users computers. The code we are using is below. Any ideas on how to stop the logon prompt appearing?
ConnectionInfo connectioninfo = new ConnectionInfo();
connectioninfo.ServerName = str_ServerName;
connectioninfo.DatabaseName = str_DatabaseName;
connectioninfo.UserID = str_User;
connectioninfo.Password = str_Password;
connectioninfo.IntegratedSecurity = false;
// Loop through main report and set connection info
foreach (Table table in crep.ReportDoc.Database.Tables)
{
TableLogOnInfo logonInfo = table.LogOnInfo;
logonInfo.ConnectionInfo = connectioninfo;
table.ApplyLogOnInfo(logonInfo);
}
// Loop through subreports and set connection info
foreach (ReportObject repobject in crep.ReportDoc.ReportDefinition.ReportObjects)
{
if (repobject.Kind == ReportObjectKind.SubreportObject)
{
SubreportObject subrepobj = (SubreportObject)repobject;
ReportDocument subrepdoc = crep.ReportDoc.OpenSubreport(subrepobj.SubreportName);
foreach (Table table in subrepdoc.Database.Tables)
{
TableLogOnInfo logonInfo = table.LogOnInfo;
logonInfo.ConnectionInfo = connectioninfo;
table.ApplyLogOnInfo(logonInfo);
}
}
}
ReportViewer reportviewer = new ReportViewer(crep.ReportDoc);
reportviewer.Show();
Hi,
It might be possible that your reports are using the native client connection and the machines prompting for logon might havenot native client installed.
Install the native client on a machine and it would resolve your issue.
Hope that works!!
Regards
Amit
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please see if this White Paper will help:
Also, have a look at this kbase:
Ludek
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for the white paper, i have given it a quick read but as far as i can tell i am already doing the same code as seen in the example above.
All the reports are setup to use integrated security = false and this is not being changed by the program. It is sql authentication only.
Also the production database is on a different server instance and has a different database name and login credentials.
Edited by: Matthew Hare on Sep 17, 2008 4:06 PM
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.