Crystal Report logon fails on webserver

Source: Internet
Author: User
Tags ole

Source: http://www.imcoder.org/report/192716.htm

 

Q:

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!

A:

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

A:

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

A:

I used your code but it isStill 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
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?

A:

Problem solved:

ConInfo. ConnectionInfo. ServerName = "server"

Changed

ConInfo. ConnectionInfo. ServerName = "ip address"

Damn this error has cost a lot of time and $

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.