Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to pass parameters from stored procedure to crystal rpt

Status
Not open for further replies.

sohrab

Technical User
Nov 21, 2000
18
CA
Hello;

I want to use Stored procedure in crystal report, but the parameters in sql as a convention, start with the Sign @, but the application that calls the report have no @ at the beginning of parameter name, so will any one please tell me how can I get rid of the @ sign.
 
If you want to pass parameters INTO a stored procedure you use the @P1, @P2, etc., in the declaration of the stored procedure.

The last SELECT statement of the stored procedure is the recordset for the Crystal Report.

Try a simple stored procedure that just does SELECT field_a, field_b FROM Table_X. Then point your new Crystal Report at the stored procedure. You'll see field_a and field_b as available database fields to use in your report. Brian J. Alves
Terrier Consulting, Inc.
Email: brian.alves@worldnet.att.net
VB / Crystal / SQLServer
 
Hi Brian;

Thanks for Respoding, My problem is that the parameter that the application needs is not matching the input parameter in stored procedure. let say if what the application need is StartDate, then I have to call my parameter StartDate. But as you know I have to have an @ at the beginning of my parameter and that is where the problem comes in.


Regards;
Sohrab
 
The names don't have to matter. Just line up the parameters in the correct order and pass them to the report.

Dim crxApp As New CRAXDRT.Application
Dim crxRep As New CRAXDRT.Report

' logon to the server

crxApp.LogOnServer "p2sodbc.dll", "dsn name", "db name", "user id", "welcome"

' open the report
Set crxRep = crxApp.OpenReport("name of rpt file")

' the report has one parameter to the stored proc
' add it to the report
crxRep.ParameterFields.Item(1).AddCurrentValue "value of parameter"
Brian J. Alves
Terrier Consulting, Inc.
Email: brian.alves@worldnet.att.net
VB / Crystal / SQLServer
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top