p2p.wrox.com Forums

Need to download code?

View our list of code downloads.

  Return to Index  

proasp_codeclinic thread: Problem passing string parameters from ASP to a Crystal Reports report

Message #1 by kathy.egan@h... on Tue, 11 Dec 2001 21:17:37
I'm invoking Crystal Reports v7.0 from an ASP page (ASP v2, IIS v4, NT 4). 
My report runs against a SQL Server v7.0 stored procedure that has a number 
of parameters.  I am setting the parameters in the ASP code like so:

set session("oApp") = Server.CreateObject("Crystal.CRPE.Application")
set session("oRpt") = session("oApp").OpenReport(strPath & strRptName, 1)
set session("oRptOptions") = session("oRpt").options
set session("paramCollection") = session("oRpt").parameterFields

set param1 =  session("paramCollection").item(1)
call param1.setCurrentValue (cint(int1),7)
set param2 =  session("paramCollection").item(2)
call param2.setCurrentValue (cstr(str1),12)

The integer parameters are being passed properly (i.e., the stored 
procedure runs and the correct data is displayed), however, when I pass 
string parameters and use the strings in the WHERE clause of the stored 
procedure's query, I get no data. If I run the stored procedure outside of 
Crystal with the string parameters, I get data.  I also verified that 
Crystal is accepting the parameter by displaying the string on the report.

Does anyone know if there is a problem passing string parameters from ASP?  
Do I need to "cast" the string into some other data type prior to 
submitting it to Crystal?

  Return to Index