locked
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 =
    "@vac_id"
    discreteVal.Value = Request.QueryString("vac_id")
    paramField.CurrentValues.Add(discreteVal)
    paramFields.Add(paramField)
    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)
    Next

    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 mySubReportObject = CType(.ReportObjects(intCounter), SubreportObject)
    mySubRepDoc = mySubReportObject.OpenSubreport(mySubReportObject.SubreportName)
    For intCounter1 = 0 To mySubRepDoc.Database.Tables.Count - 1
    mySubRepDoc.Database.Tables(intCounter1).ApplyLogOnInfo(conInfo)
    mySubRepDoc.Database.Tables(intCounter1).ApplyLogOnInfo(conInfo)
    Next
    End If
    End With
    Next
    Next


    Return True
    Catch
    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;

     

    cryRpt.Load(Server.MapPath(
    "CrystalOT.rpt"));

     

    {

    crConnectionInfo.IntegratedSecurity =
    true;

    crConnectionInfo.ServerName = "221.23.0.15";

    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;

    CrTable.ApplyLogOnInfo(crtableLogoninfo);

    }

     

    CrystalReportViewer1.ReportSource = cryRpt;

    CrystalReportViewer1.DataBind();

    CrystalReportViewer1.RefreshReport();

     

    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

    Try
    rapport.Load(mapReports & "persoon_algemeen.rpt")
    conInfo.ConnectionInfo.UserID =
    "login"
    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
    rapport.Database.Tables(intcounter).ApplyLogOnInfo(conInfo)
    Next

    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
    mySubRepDoc.Database.Tables(intcounter1).ApplyLogOnInfo(conInfo)
    Next

    End If
    End With
    Next
    Next
    paramField.ParameterValueType = ParameterValueKind.StringParameter
    paramField.ParameterFieldName =
    "@p_id"
    discreteVal.Value = Session.Contents("persoon_id")
    paramField.CurrentValues.Add(discreteVal)
    paramFields.Add(paramField)
    crvCV.ParameterFieldInfo = paramFields
    crvCV.ReportSource = rapport
    Catch ex As System.Exception
    MsgBox(ex.Message)
    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

    examples
    DataSource=myservername\myinstancename,1433
    DataSource=myservername,1433
    DataSource=113.132.223.33,1433
    DataSource=113.132.223.33\myInstancename,1433

    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