Crystal reports database login failed error

Posted on 2011-09-13
Last Modified: 2012-05-12
HI, I am using multiple crystal reports in my website and yesterday I just added two new ones.  These new ones are using the exact same connection info as the previous reports.

When I make changes to my website the changes are first published to a test server, tested and then published to my production server.  When I run my reports on the test server the reports work fine; however when I run the reports from my production server I get a 'Database logon failed' error.

I have included the code from the page where I run one of the reports. I am disabling the database prompt and automatically populating this in the backend code. In all of my previous reports I only had to specify the username and password.  I tried adding the db server and database to the code for the new reports and I still get the same error.

<%@ Page Title="DSI Marketing System" Language="vb" AutoEventWireup="false" MasterPageFile="~/Styles/Reports.Master" CodeBehind="AwardedProjectsReport.aspx.vb" Inherits="MarketingSystem.AwardedProjectsReport" %>
<%@ Register assembly="CrystalDecisions.Web, Version=11.5.3700.0, Culture=neutral, PublicKeyToken=692fbea5521e1304" namespace="CrystalDecisions.Web" tagprefix="CR" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderHeading" runat="server">
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolderBody" runat="server">

<asp:Button ID="btnreports" runat="server" CssClass="button" Text="Back To Reports" />

    <CR:CrystalReportSource ID="CrystalReportSource1" runat="server">
     <Report FileName="Awarded Projects Report.rpt">
     <CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" 
        AutoDataBind="true" EnableDatabaseLogonPrompt="False" EnableParameterPrompt="True"
        ReportSourceID="CrystalReportSource1" ReuseParameterValuesOnRefresh="True" DisplayGroupTree="False" />


Backend code:
Public Partial Class AwardedProjectsReport
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

    End Sub
    Protected Sub CrystalReportSource1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles CrystalReportSource1.Load
        CrystalReportSource1.ReportDocument.SetDatabaseLogon("username", "password", "dbserver", "databasename")

    End Sub

    Protected Sub btnreports_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnreports.Click
    End Sub
End Class

Open in new window

Question by:imstac73
  • 4
  • 3
LVL 16

Expert Comment

by:Bryan Butler
ID: 36529914
Can you compare the working ones from production to the new ones?  There should be a difference that's causing this.  What version of crystal?  Are you creating these through the GUI or strictly coding?  Also check you path specifications.  You may need to use complete paths in the XML.
LVL 100

Expert Comment

ID: 36529962
Are these using a different set of tables/views/SPs from previous reports?
Perhps the user needs permissions to the tables/views/SPs these reports use


Author Comment

ID: 36530459
Using Crystal Reports XI R2.  I compared the reports and they are using the same connection and are set up the same way.  

mlmcc:  If it was a permissions issue I wouldn't think that it would work on my dev server either because I am using sql user credentials.
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

LVL 100

Expert Comment

ID: 36530863
Is this a thick or thin client application?

Thick client applications run using the logged in Windows user.
Thin clients usually run with a system user.  The system user may be different on each server.


Author Comment

ID: 36531055
mlmcc...not sure what you mean by that.  I don't handle the administration of the web server.

I think the problem was that I was using a different data provider so I changed my new reports to match the other reports; however now when I try to build my solution I get a "Warning      2      Found conflicts between different versions of the same dependent assembly.      MarketingSystem" message and it will not let me build.

My version of Crystal Reports is full version, developer version and my assembly version listed in my web.config file is  Do I need to update the CR references in my solution?
LVL 100

Expert Comment

ID: 36531809
Sounds like it.


Accepted Solution

imstac73 earned 0 total points
ID: 36719330
The problem was that I was using SQL Server Native Client for my connection and my production server was not set up to handler using this connection type.  I changed my connection to oledb for sql server and it worked after that.

Author Closing Comment

ID: 36902275
Resolved it myself

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
I hate sub reports and always consider them the last resort in any reporting solution.  The negative effect on performance and maintainability is just not worth the easy ride they give the report writer.  Nine times out of ten reporting requirements…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question