cancel
Showing results for 
Search instead for 
Did you mean: 

Logon failed

0 Kudos

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/

Accepted Solutions (1)

Accepted Solutions (1)

DellSC
Active Contributor
0 Kudos

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

0 Kudos

I am connecting to the database. Attached is the code for setting report credentials. The app is 32 bit due to constarints of a thrid party package. I think that may be the problem, how do I force the report to run 32 bit?

DellSC
Active Contributor
0 Kudos

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

0 Kudos

No there is no subreport.

DellSC
Active Contributor
0 Kudos

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

0 Kudos

Attached is info from exception it throws.

I am using native client connection.

DellSC
Active Contributor
0 Kudos

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

0 Kudos

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.

DellSC
Active Contributor
0 Kudos

Crystal doesn't have "native" connection to SQL Server - so are you using an OLEDb connection in the report or an ODBC connection?

-Dell

former_member183750
Active Contributor
0 Kudos

You must use the frm 4 full client...

- Ludek

Senior Support Engineer AGS Product Support, Global Support Center Canada

Follow us on Twitter

0 Kudos

Microsoft OLE DB for SQL Server

0 Kudos

I went into the report to print and updated thee data source to make sure I was using the correct provider and now the message is :

Message"\rFailed to open the connection.\nwt_cert 10124_11604_{BAEB58DB-C37C-419D-ABEB-1DEA66805A01}.rpt\nDetails:  [Database Vendor Code: 17 ]"string
DellSC
Active Contributor
0 Kudos

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

0 Kudos

Ok I have tried a bunch of different solutions, none working yet. Attached is a screen shot of debug window, is the blank ReportName and Tablename value the problem, I tried adding them and got the message "Unspecified error".

former_member183750
Active Contributor
0 Kudos

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

Answers (0)