Crystal Reports 9.2 and Stored Procedure Problems II
I'm working with:
VB6
Crystal Reports 9.2.2.693
SQL Server
I connect via OLEDB
I already have added Crystal Reports 9 ActiveX Designer RunTime Library and Crystal Reports Viewer 9 to References as well as Crystal Report Viewer 9 to Components.
Ok, I have setup my report all from within the report. The database, the stored procedure, and the fields I'm going to display.
I'm passing parameters via a stored procedure from VB6 to SQL
One of the setups at the report is the initial values for the parameters at the stored procedure. Suppouse I choose '0' and '0'.
When I call the report it display all ok but if I send anything different to these values like '0' and '1' it will throw me the following error:
"
Logon failed.
Details: ADO Error Code: 0x80040e4d
Source: Microsoft OLE DB Provider for SQL Server
Description: Login failed for user 'sa'.
SQL State: 42000
Native Error: 18456
"
I've tried to authenticate in both ways: SQL Authentication and Windows Integrated. Same problem.
Why could this be?
Hope you can help me figure this out.
Marcelo.
Re: Crystal Reports 9.2 and Stored Procedure Problems II
I really need to solve this. Can anyone help me figure this out?
Thanks in advanced, Marcelo.
Re: Crystal Reports 9.2 and Stored Procedure Problems II
Post your VB code that Opens and Executes the report. Not all login information is saved in the report file, you must set it within your VB app.
Re: Crystal Reports 9.2 and Stored Procedure Problems II
Quote:
Originally Posted by brucevde
Post your VB code that Opens and Executes the report. Not all login information is saved in the report file, you must set it within your VB app.
Hi Bruce, the following is the code I use:
Dim objCrystal As CRAXDRT.Application 'its better to create this object global to the VB application.
Dim objReport As CRAXDRT.Report
Dim objParam As CRAXDRT.ParameterFieldDefinition
Dim Filename As String
Set objCrystal = New CRAXDRT.Application
Filename = App.Path & "\Reports\report6.rpt"
Set objReport = objCrystal.OpenReport(Filename, 1)
Set objParam = objReport.ParameterFields.GetItemByName("@parColumnNumber")
objParam.ClearCurrentValueAndRange
objParam.AddCurrentValue "A"
Set objParam = objReport.ParameterFields.GetItemByName("@parColumnOrder")
objParam.ClearCurrentValueAndRange
objParam.AddCurrentValue "B"
With Form8
'If Len(ReportTitle) > 0 Then
'.Caption = ReportTitle
'End If
.CRViewer.ReportSource = objReport
.CRViewer.ViewReport
.Show vbModal
.ZOrder vbBringToFront
End With
End Select
So, where and how should I say Crystal Report how to open my database which by the way is SQL Server via OLEDB.
Thanks again! Marcelo.
Re: Crystal Reports 9.2 and Stored Procedure Problems II
Bruce, I've posted the code. Can you see what's wrong with it? Thanks. Marcelo.