Crystal Report logon fails on webserver RRS feed

  • Question

  • User334136954 posted

    Hi all,

    Since we upgrated from sqlserver2000 to sqlserver2005 my reports won't work anymore on the webserver. On my dev machine they work perfect.
    I use an OLE DB connection to the server, I already edited the provider to SQLOLEDB (standard SQLCLNT).

    I receive this error:

    Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. SQL State: 08001 Native Error: Logon failed. Details: ADO Error Code: 0x Source: Microsoft OLE DB Provider for SQL Server Description: Invalid connection string attribute SQL State: 01S00 Error in File C:\WINDOWS\TEMP\rptVacatureDetail {D27274A5-95FE-4A8F-A5E3-C1CF7A584B06}.rpt: Unable to connect: incorrect log on parameters.

    The following code loads & connects the report

    Dim rapport As New ReportDocument
    rapport.Load(mapReports & "rptVacatureDetail.rpt")
    rapport.SetDatabaseLogon("loginname", "password", "severname", "database")
    paramField.ParameterFieldName =
    discreteVal.Value = Request.QueryString("vac_id")
    reportviewer.ParameterFieldInfo = paramFields

    reportviewer.ReportSource = rapport

    This simple code has always worked for me, it still does on my devmachine but as soon the application is published the reports won't show

    Thanks in advance!

    Friday, June 13, 2008 10:01 AM

All replies

  • User-1419011324 posted

    Use this code


        Dim conInfo As New TableLogOnInfo

    Try objReport.Load(Server.MapPath(sReportName)) conInfo.ConnectionInfo.UserID = <UserName> conInfo.ConnectionInfo.Password = <Password> 'conInfo.ConnectionInfo.IntegratedSecurity = True conInfo.ConnectionInfo.ServerName = <ServerName> ConInfo.ConnectionInfo.DatabaseName = <Database> For intCounter = 0 To rapport .Database.Tables.Count - 1
    rapport .Database.Tables(intCounter).ApplyLogOnInfo(ConInfo)

    index = 0 To rapport .ReportDefinition.Sections.Count - 1
    For intCounter = 0 To rapport .ReportDefinition.Sections(index).ReportObjects.Count - 1
    With rapport .ReportDefinition.Sections(index)
    If .ReportObjects(intCounter).Kind = ReportObjectKind.SubreportObject Then mySubReportObject = CType(.ReportObjects(intCounter), SubreportObject)
    mySubRepDoc = mySubReportObject.OpenSubreport(mySubReportObject.SubreportName)
    For intCounter1 = 0 To mySubRepDoc.Database.Tables.Count - 1
    End If
    End With

    Return True
    ex As System.Exception
    'MsgBox(ex.Message) End Try
    End Function
    Sunday, June 15, 2008 2:20 AM
  • User-2004110967 posted

    I have the same problem.

    This is my code in C#.

    ReportDocument cryRpt = new ReportDocument();

    TableLogOnInfos crtableLogoninfos = new TableLogOnInfos();

    TableLogOnInfo crtableLogoninfo = new TableLogOnInfo();

    ConnectionInfo crConnectionInfo = new ConnectionInfo();

    Tables CrTables;





    crConnectionInfo.IntegratedSecurity =

    crConnectionInfo.ServerName = "";

    crConnectionInfo.DatabaseName = "UATKTBLEASING";

    crConnectionInfo.UserID = "sa";

    crConnectionInfo.Password = "ktbladmin";



    CrTables = cryRpt.Database.Tables;

    foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables)


    crtableLogoninfo = CrTable.LogOnInfo;

    crtableLogoninfo.ConnectionInfo = crConnectionInfo;




    CrystalReportViewer1.ReportSource = cryRpt;




    Thank you for your help

    Monday, June 16, 2008 12:18 AM
  • User334136954 posted

    I used your code but it is still not working. I also ran into some parameter problems wich I solved via a patch from crystal reports (://support.businessobjects.com/library/kbase/articles/c2018840.asp )

    My code now

    Dim conInfo As New TableLogOnInfo
    Dim intcounter, intcounter1, index As Int16

    rapport.Load(mapReports & "persoon_algemeen.rpt")
    conInfo.ConnectionInfo.UserID =
    conInfo.ConnectionInfo.Password = "paswoord"
    conInfo.ConnectionInfo.IntegratedSecurity = False
    conInfo.ConnectionInfo.ServerName = "server"
    conInfo.ConnectionInfo.DatabaseName = "database"
    For intcounter = 0 To rapport.Database.Tables.Count - 1

    For index = 0 To rapport.ReportDefinition.Sections.Count - 1
    For intcounter = 0 To rapport.ReportDefinition.Sections(index).ReportObjects.Count - 1
    With rapport.ReportDefinition.Sections(index)
    If .ReportObjects(intcounter).Kind = ReportObjectKind.SubreportObject Then
    Dim mySubReportObject As SubreportObject
    Dim mySubRepDoc As ReportDocument
    mySubReportObject =
    CType(.ReportObjects(intcounter), SubreportObject)
    mySubRepDoc = mySubReportObject.OpenSubreport(mySubReportObject.SubreportName)
    For intcounter1 = 0 To mySubRepDoc.Database.Tables.Count - 1

    End If
    End With
    paramField.ParameterValueType = ParameterValueKind.StringParameter
    paramField.ParameterFieldName =
    discreteVal.Value = Session.Contents("persoon_id")
    crvCV.ParameterFieldInfo = paramFields
    crvCV.ReportSource = rapport
    Catch ex As System.Exception
    End Try


    Can anybody help?

    Thursday, June 19, 2008 6:06 AM
  • User334136954 posted

    Problem solved:

    conInfo.ConnectionInfo.ServerName = "server"

    changed into

    conInfo.ConnectionInfo.ServerName = "ip address"

    Damn this error has cost a lot of time and $


    Thursday, June 19, 2008 7:58 AM
  • User1153435792 posted
    I was struggling with same problem for 2 days...

    also use port number to solve the problem.

    use datasource=servername or ip address\instance name if availabel,port number


    default port number is 1433 or 1434

    my problem is solved with this, posting for the use of others.
    Monday, October 13, 2014 10:12 AM
  • User1196771204 posted

    I am glad to know that you have solved this issue

    Next time, what you can possible do is to try to connect to your SQL Server database with the SQL Management Studio (SSMS) tool. If you can connect with this tool, you just need to use the same, exact SQL details on your code. If you cannot even connect with this tool, then you have to find out the issue (whether it is the wrong IP Address or the db username/password)

    Hope this helps

    Wednesday, October 22, 2014 1:27 AM