on 11-19-2014 9:15 PM
I have reports developed under crystal 2008 have been running under vs2010 app just fine. Update to vs2013 and installed reports runtime for .net version 13.0.12.1494. the references in the project are all 13.0.2000.0. The reports now die with Logon failed message. What do I need to change/
Are you using an DataSet from your app or are you connecting to the database in your report. If it's the latter, what is your code for setting the database credentials for the report?
Is your app 32-Bit, 64-Bit or compiled for "Any CPU"?
-Dell
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Does the report have any subreports? If so, you also have to set the LogOnInfo for all of the tables in the subreport. The code is similar to what you have, but you have to walk through the sections of the report to find the subreport so that you can get the tables to set the logins.
Here's some sample code for this:
//set the crSections object to the current report's sections
crSections = crReportDocument.ReportDefinition.Sections;
//loop through all the sections to find all the report objects
foreach(Section crSection in crSections)
{
crReportObjects = crSection.ReportObjects;
//loop through all the report objects to find all the subreports
foreach(ReportObject crReportObject in crReportObjects)
{
if (crReportObject.Kind == ReportObjectKind.SubreportObject)
{
//you will need to typecast the reportobject to a subreport
//object once you find it
crSubreportObject = (SubreportObject)crReportObject;
//open the subreport object
crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);
//set the database and tables objects to work with the subreport
crDatabase = crSubreportDocument.Database;
crTables = crDatabase.Tables;
//loop through all the tables in the subreport and
//set up the connection info and apply it to the tables
foreach(Table crTable in crTables)
{
crConnectioninfo.ServerName = ServerName;
crConnectioninfo.DatabaseName = DatabaseName;
crConnectioninfo.UserID = UserID;
crConnectioninfo.Password = Password;
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectioninfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
}
}
}
-Dell
What is the complete text of the error message that you're getting?
Also, what type of database connection are you using? If it's ODBC, you need to make sure that the ODBC System DSN has been configured in the 32-bit ODBC Administrator (link is in the same place as the Crystal Reports link on your Start Menu). This means that you must have the 32-bit version of the database drivers installed - whether it's ODBC, OLEDb, or a native connection - regardless of whether you're working on a 64-bit machine.
Also, in the Properties for your application, it MUST target "x86" and NOT "Any CPU" in order for this to work correctly.
-Dell
What type of database are you connecting to? The info you posted doesn't show whether there was a database error on login.
Which .NET framework are you targeting? If it's 4.0 or newer, go to all of the CrystalDecisions references in your app and make sure that the "Embed Interop Types" property is set to False. (This property doesn't exist in older versions of the framework...)
I see that your code is trying to print directly to a printer. Is the printer configured on the workstation? Also, do you have any code for viewing a report instead of printing it? Does that code work? If not, please post an image of the error screen that appears.
-Dell
SQL server express 2012. Targeting .net 4 (full not client). Checked Interop types, CRVsPachageLib was set to true. Changed to false and rebuilt, still the same.
I have another form that uses a report viewer. Do not get an error just pops up a login dialogue with only the server name no database or integrated box checked. Attached is the set for the viewer.
You must use the frm 4 full client...
- Ludek
Senior Support Engineer AGS Product Support, Global Support Center Canada
Follow us on Twitter
The "Database Vendor Code" is what I was looking for - this is the error code returned from SQL Server. If you do a Google Search on 'MS SQL Server Error 17', you'll see that this code means "Server does not exist or access denied". So, something it not quite right with the connection you're setting for the tables.
-Dell
For MS SQL 2012, make sure you are using the SQL Native 11 client. Anything else will fail...
For Vendor Error Code, always search your database documentation as this is an error thrown by the db and passed through the report engine unmodified...
In this case error 17 for SQL is "SQL Server does not exist or access denied."
Do confirm you are using the full 4.x framework - not the client frm...
Do confirm you are using SP 12:
Do compile as 32 bit, not Any CPU.
- Ludek
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
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.