Link to home
Start Free TrialLog in
Avatar of TikkTakk-Aicon
TikkTakk-AiconFlag for Iceland

asked on

Crystal reports logon failed

When I run my project locally on my computer I can generate the CR like I want to.  But when I put the webpage on the server I get this error when I try to run the report page: Logon failed. Details: IM002:[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified Error in File C:\WINDOWS\TEMP\CrystalReport {249B0DAC-9F96-4B28-8CDA-F8BB94956BB2}.rpt: Unable to connect: incorrect log on

Below is my page_load function, can anybody help me on this issue ? (I have replaced my server logon information)
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim Busnumer, ELS_numer As Integer
        Dim crConnectionInfo As New ConnectionInfo
        Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables
        Dim crtableLogoninfo As CrystalDecisions.Shared.TableLogOnInfo 
        Busnumer = Request.QueryString("Busnumer")
        ELS_numer = Request.QueryString("ELS_Numer") 
        '
        ' Load the selected report file.
        '
        Dim CR As New ReportDocument
        CR.Load("F:\Aicon\MAST-Eftirlit\CrystalReport.rpt") 
        With crConnectionInfo 
            .ServerName = "SQL-SERVER" 
            .DatabaseName = "DBNAME" 
            .UserID = "USERID" 
            .Password = "PASSWORD" 
        End With 
        crTables = CR.Database.Tables 
        'sets connection info. for database tables 
        For Each crTable In crTables 
            crtableLogoninfo = crTable.LogOnInfo 
            crtableLogoninfo.ConnectionInfo = crConnectionInfo 
            crTable.ApplyLogOnInfo(crtableLogoninfo) 
        Next 
        '
        ' Declare the parameter related objects.
        '
        Dim crParameterDiscreteValue As ParameterDiscreteValue
        Dim crParameterFieldDefinitions As ParameterFieldDefinitions
        Dim crParameterFieldLocation As ParameterFieldDefinition
        Dim crParameterValues As ParameterValues
        '
        ' Get the report's parameters collection.
        '
        crParameterFieldDefinitions = CR.DataDefinition.ParameterFields
        '
        ' Set the first parameter
        ' - Get the parameter, tell it to use the current values vs default value.
        ' - Tell it the parameter contains 1 discrete value vs multiple values.
        ' - Set the parameter's value.
        ' - Add it and apply it.
        ' - Repeat these statements for each parameter.
        '
        crParameterFieldLocation = crParameterFieldDefinitions.Item("Busnumer")
        crParameterValues = crParameterFieldLocation.CurrentValues
        crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
        crParameterDiscreteValue.Value = Busnumer
        crParameterValues.Add(crParameterDiscreteValue)
        crParameterFieldLocation.ApplyCurrentValues(crParameterValues) 
        crParameterFieldLocation = crParameterFieldDefinitions.Item("ELS_numer")
        crParameterValues = crParameterFieldLocation.CurrentValues
        crParameterDiscreteValue = New CrystalDecisions.Shared.ParameterDiscreteValue
        crParameterDiscreteValue.Value = ELS_numer
        crParameterValues.Add(crParameterDiscreteValue)
        crParameterFieldLocation.ApplyCurrentValues(crParameterValues)
        '
        ' Set the Crytal Report Viewer control's source to the report document.
        '
        CrystalReportViewer1.ReportSource = CR
    End Sub

Open in new window

Avatar of Mike McCracken
Mike McCracken

What version of Crystal?

What else did you load on the server when you installed the report?

Did you give the web_user permissiions to the database? to the Crystal files?
  I don't think the logged in userid is used for permissions.

mlmcc
>Data source name not found and no default driver specified Error

The above part of the error suggests that ODBC drivers for SQL Server are probably not installed on the server.
Avatar of TikkTakk-Aicon

ASKER

Where can I view the CR version ?

I did set up the same System DSN on the web server as I have on my computer, that didn´t change a thing.  The IIS web user has write permission on the whole folder on the server.

@CodeCruiser:  Can I check somewhere on the server if ODBC drivers for SQL server are installed ?
You need to logon to server to see that.
I have semi-full access to the server and full access to the technicians who service it...
Crystal also uses the temp directories and has virtuall directories.  The web user needs permissions to them.

When you design the report you can use the HELP --> ABOUT CRYSTAL to get the version

mlmcc
Ok, where can I find these temp and virtual directories to give the web user permission (although I don´t think that is the problem here).

Can´t see ABOUT CRYSTAL in the Help menu when I design the report.

Isn´t the probem I´m facing in the code I posted in the beginning ?
Ok, I did some small changes to the .ServerName in the codebehind and now I get this error... some progress here at least :)  Do I need to make some changes to the System DSN I created on the server ?

Login failed for user 'NT AUTHORITY\ANONYMOUS LOGON
Looks like the server is configured for Windows Authentication only. Make sure it allows Both Windows and SQL Server authentication.
Or that the anonymous logon has permissions in the database

mlmcc
I changed the login information in the System DSN and now I can generate reports !  There is one problem now regarding the images in the top of the report (see attached image).  I also think there is some problem with printing (the printing is set to PDF and works ok when I run this locally on my computer).
report.jpg
ASKER CERTIFIED SOLUTION
Avatar of TikkTakk-Aicon
TikkTakk-Aicon
Flag of Iceland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial