RAS stored procedure with parameter problem
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: RAS stored procedure with parameter problem

  1. #1
    Join Date
    Dec 2003
    Posts
    9

    RAS stored procedure with parameter problem

    Hi, I have a problem with pass parameter value to crystal
    report with stored procedure, in this case i have to pass
    COLID(type= Uniqueidentifier) that refer to parameter in the
    crystal report based on stored procedure. I have try to
    pass..but it still no data show on my activex viewerI use RAS SDK
    on my server.thx
    Hope reply soon.....thx a lot
    FIle Attached below
    Attached Files Attached Files

  2. #2
    Join Date
    Apr 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    1,792
    I think you need to take the sub out of the IF statement - I'm not convinced that it will ever be executed.
    Be nice to Harley riders...

  3. #3
    Join Date
    Dec 2003
    Posts
    9
    I'm not put If statement it was, but that was nothing parameter has passed too....

  4. #4
    Join Date
    Apr 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    1,792
    Your code has the following line:

    Code:
    If Flag = "Personnel" Then
    	Sub PassParameter(strParamName, ParamValue)
    
        	'Determine the index position of the parameter in the report
        	ParamIndex = Session("oClientDoc").DataDefinition.ParameterFields.Find(strParamName, 0)
    	
        	'Get parameter in the report at the position ParamIndex
        	Set objParam = Session("oClientDoc").DataDefinition.ParameterFields.Item(ParamIndex)
    
        	'Clone the parameter object so we can modify it
        	Set objNewParam = objParam.Clone
    
        	'Add parameter field value to this object
        	objNewParam.CurrentValues.Add ParamValue
    
        	'Insert the modified parameter back into the report
        	Session("oClientDoc").DataDefController.ParameterFieldController.Modify ParamIndex, objNewParam
            
    	End Sub
    
    ' The included sample report has a parameter for each type of value in Crystal Reports
    ' Pass the parameter values by name to the report - the subroutine expects
    ' the following arguments: Parameter Name, Parameter Value
    ' The subroutine also works for multi-value discrete parameters
    	PassParameter "@PM_EMPLOYEECOLID", Cstr("aa")
    End If
    Change it to
    Code:
    	Sub PassParameter(strParamName, ParamValue)
    
        	'Determine the index position of the parameter in the report
        	ParamIndex = Session("oClientDoc").DataDefinition.ParameterFields.Find(strParamName, 0)
    	
        	'Get parameter in the report at the position ParamIndex
        	Set objParam = Session("oClientDoc").DataDefinition.ParameterFields.Item(ParamIndex)
    
        	'Clone the parameter object so we can modify it
        	Set objNewParam = objParam.Clone
    
        	'Add parameter field value to this object
        	objNewParam.CurrentValues.Add ParamValue
    
        	'Insert the modified parameter back into the report
        	Session("oClientDoc").DataDefController.ParameterFieldController.Modify ParamIndex, objNewParam
            
    	End Sub
    
    ' The included sample report has a parameter for each type of value in Crystal Reports
    ' Pass the parameter values by name to the report - the subroutine expects
    ' the following arguments: Parameter Name, Parameter Value
    ' The subroutine also works for multi-value discrete parameters
    If Flag = "Personnel" Then
    	PassParameter "@PM_EMPLOYEECOLID", Cstr("aa")
    End If
    [/code]
    Be nice to Harley riders...

  5. #5
    Join Date
    Dec 2003
    Posts
    9
    i still have a problem when i try to pass parameter value to crystal report with stored procedure. It shows an error like this "clientdoc.dll error 800200b" - Unknown error


    Sub PassParameter(strParamName, ParamValue)

    'Determine the index position of the parameter in the report
    ParamIndex = Session("oClientDoc").DataDefinition.ParameterFields.Find(strParamName, 0)

    ==>>an ERror Point to This Line
    'Get parameter in the report at the position ParamIndex
    Set objParam = Session("oClientDoc").DataDefinition.ParameterFields.Item(ParamIndex)

    'Clone the parameter object so we can modify it
    Set objNewParam = objParam.Clone

    'Add parameter field value to this object
    objNewParam.CurrentValues.Add ParamValue

    'Insert the modified parameter back into the report
    Session("oClientDoc").DataDefController.ParameterFieldController.Modify ParamIndex, objNewParam

    End Sub


    %>

    If Flag = "Personnel" Then
    PassParameter "@PM_EMPLOYEECOLID", Cstr("aa")
    End If




    <!-- #include file="ActiveXViewer.asp" -->
    <Form>
    <INPUT TYPE = "hidden" name = "Report">
    <INPUT TYPE = "hidden" name = "Flag">
    <INPUT TYPE = "hidden" name = "EmployeeCOLID">
    </Form>

  6. #6
    Join Date
    Apr 2002
    Location
    Melbourne, Victoria, Australia
    Posts
    1,792
    I've pretty much exhausted my knowledge of Crystal via ASP now - but I suggest you look at the way you're creating the Session client doc object

    Set Session("oClientDoc") = objFactory.CreateObject("CrystalClientDoc.ReportClientDocument")

    Does the factory object have a method "CreateObject"? If not, then your syntax to create the doc object will not work
    Be nice to Harley riders...

  7. #7
    Join Date
    Dec 2003
    Posts
    9

    Unhappy

    hi , sorry bout my last post and for your correction on the "If statement" , i've did the report work now, but there is another problem now, The COLID that i will pass through the parameter value is Uniqueidentifier data type, so...maybe that's the problem the parameter value not pass to my report.
    So everytime open my report on my asp page, just preview my default value not the value that I pass from my ASP page.

    I've read from crystaldecision about passing the parameter through stored procedure with uniqueidentifier, about how to convert them in the stored procedure. Just like i Said , if i prompt a value manually in the crystal report designer it works correctly.....but it just like that even i pass a value from asp page.....
    thx a lot anyway for helping me much..cause i get weird....
    Last edited by endrue; December 8th, 2003 at 09:08 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center