I am trying to connect to a a stored procedure, then attached it to a Crystal Report already built, to update the data. This code almost gets there, but gives me a popup "Crystal Report Viewer"..."This field name is not known." and the report is blank. I can't see the data in the locals, but the command code seems to be recognised.
In fact I would settle for using Crystal's own popup that ask users for the stored procedure parameters, but using code would be more manageable.
This is the code in the DSR that should attach the report to the data.
Any ideas?
Dim adoRst As New ADODB.Recordset
Dim adoCmd As ADODB.Command
Dim adoCon As New ADODB.Connection
Set adoRst = New ADODB.Recordset
Set adoCmd = New ADODB.Command
adoRst.CursorType = adOpenStatic
adoRst.LockType = adLockOptimistic
With adoCmd
.ActiveConnection = strConnection
.CommandType = adCmdStoredProc
.CommandText = "rptBlotter"
.Parameters("@BusinessDate").Value = CDate(2005 - 9 - 1)
.Parameters("@IsCashYorN").Value = "Y"
.Parameters("@IsLoanYorN").Value = "N"
End With
Set adoRst = adoCmd.Execute
Database.SetDataSource adoRst
[/color blue]
In fact I would settle for using Crystal's own popup that ask users for the stored procedure parameters, but using code would be more manageable.
This is the code in the DSR that should attach the report to the data.
Any ideas?
Dim adoRst As New ADODB.Recordset
Dim adoCmd As ADODB.Command
Dim adoCon As New ADODB.Connection
Set adoRst = New ADODB.Recordset
Set adoCmd = New ADODB.Command
adoRst.CursorType = adOpenStatic
adoRst.LockType = adLockOptimistic
With adoCmd
.ActiveConnection = strConnection
.CommandType = adCmdStoredProc
.CommandText = "rptBlotter"
.Parameters("@BusinessDate").Value = CDate(2005 - 9 - 1)
.Parameters("@IsCashYorN").Value = "Y"
.Parameters("@IsLoanYorN").Value = "N"
End With
Set adoRst = adoCmd.Execute
Database.SetDataSource adoRst
[/color blue]