VB Crystal Report >> Crystal reports - problem with parameters

by andrew.bupp » Thu, 21 Apr 2005 07:59:46 GMT

Hello,


I have a error message that is taking way too long to figure out. Any
suggestions? Code and error below.


CODE:


public void SpWithViewer (string UserId,
string PassWord,
string spParameter)
{


SPReport1 MyReport = new SPReport1();


CrystalDecisions.Shared.TableLgOnInfo
MyLogonInfo;
CrystalReportViewer1.LogOnInfo = new
CrystalDecisions.Shared.TableLgOnInfos();


MyLogonInfo = new
CrystalDecisions.Shared.TableLgOnInfo();
MyLogonInfo.TableName = "stored_procedure;1";
MyLogonInfo.ConnectionInfo.UseID = UserId;
MyLogonInfo.ConnectionInfo.Pasword =
PassWord;

CrystalReportViewer1.LogOnInfoAdd(MyLogonInfo);
// Create the parameter
CrystalDecisions.Shared.ParameerFields
ParameterFields;
CrystalDecisions.Shared.ParameerField
ParameterField;

CrystalDecisions.Shared.ParameerDiscreteValue spValue;
ParameterFields =
CrystalReportViewer1.ParameterieldInfo;
ParameterField =
ParameterFields["@Study_ID_Parm"];
spValue = new
CrystalDecisions.Shared.ParameerDiscreteValue();
spValue.Value = spParameter;
ParameterField.CurrentValues.Ad(spValue);


CrystalReportViewer1.ReportSouce = MyReport;

}


ERROR:
Specified argument was out of the range of valid values.
Description: An unhandled exception occurred during the execution of
the current web request. Please review the stack trace for more
information about the error and where it originated in the code.


Exception Details: System.ArgumentOutOfRangeExcepion: Specified
argument was out of the range of valid values.

The above sample code is taken from the Brian Bischof book, Crystal
Reports .NET Programming.

Thanks in advance,
-Andybu



Similar Threads

1. problem calling a Crystal report 9 from vb 6 code when a parameter is set - Visual Basic

2. Crystal Reports XI ASP.NET C#: problems with parameters

I gave up, and used a xsd-schema as datasource instead.
//Anders


 XXXX@XXXXX.COM  skrev:

> Hi.
>
> I have a Crystal XI report which is based on an Oracle PL/SQL procedure
> at design time. In the reportdesignenvironment, I can se the values of
> the parameters when I run the report.
>
> But when I view the same report in my aspx-page - the value of the
> parameters just won't show.
>
> Background:
>
> I use a DataSet as the datasource for my report in my aspx-page. The
> dataset is populated by a stored procedure call.
>
> I use Businessobjects CR XI C# Web .NET-examplecode to set the values
> of the parameters, and as far I can see, the value of the parameters
> are set.
>
> When I loop through the parameters of the report, after having set the
> values, the property hasValue is true. I also see that the type of the
> parameter is storedprocedureParameter.
>
>
> Is this a known bug? Or am I missing something? My LCD-screen and
> office window is in danger if I doesn't solve the problem soon ;)
> 
> If anyone have an idea - feel free to share it with me!

3. Crystal Reports XI ASP.NET C#: problems with parameters - VB Crystal Report

4. VB6 and Crystal Report 7 (Parameter problem)

To all,

I'm using VB6 service pack 5; now I've written a crystal report with 3
parameter fields which will decide the grouping (ie. acting like the
sql where clause to filter records) of the data

I've added a Crystal Report control in the vb project; then I tried to
supply the parameters to the report object like this

    With rptObj
        .ReportFileName = "c:\abc.rpt"
        .ParameterFields(0) =
          "pStartDate;" & "Date(1999,1,1)" & ";false"
        .ParameterFields(1) =
          "pEndDate;" & "Date(2009,1,1)" & ";false"
        .ParameterFields(2) =
          "pActionUser;" & Trim(Me.mCbo_Users.Text)
          & "opopoop;false"
        .Action = 1
    End With


The error is :
Runtime error 20553
Unexpected type for parameter field....

somehow I've found many examples using Date (1900,1,1) to pass a date
value parameter (though these samples are usually crystal report 8 or
above)

Any ideas on solving this problem ?

Thanks

>From Jason (Kusanagihk)

5. problem printing crystal reports 7 report from vb 6 - VB Crystal Report

6. Problem opening crystal report in crystalreportviewer, says report file not found

I created this test project and published it.  I then tried installing
it on another machine and it installs fine.  but when I go to open the
crystalreportviewer to show my created report I get an error saying it
cant and load the file.  when I run it on my machine it works fine, its
like when I build the project the crystal report is not getting
included.  Does anyone know where the setting is to include the crystal
report in the build or publishing of the application within vb.net
2005.  Here is the code I have in my crystal report viewer if it helps.

Private Sub FormCrRptViewer_Load(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles MyBase.Load

        reportDocument1.Load(Application.StartupPath &
"\CrystalReport3.rpt")

        Dim dv As DataView

        dv = New DataView(Form1.AccuLogicDataSet1.WorkList)

        reportDocument1.SetDataSource(dv)

        reportDocument1.Refresh()


        With CrystalReportViewer1 'ReportViewer1

            .DisplayGroupTree = True

            .DisplayToolbar = True

            .ReportSource = reportDocument1

            .Refresh()


        End With

    End Sub

7. Sending parameters from VB.NET to crystal report - Microsoft .NET Framework

8. Passing parameters to Crystal reports VS 2005 - VB - Net 2.0

I am new to all this so please be gentle.

I wish to pass 3 parameters (in other reports there may be more or
less) from a web form to a crystal report(which is based on a stored
procedure) that can either be on the same aspx page or on its own aspx
page.

I have found a few examples here none of which I can get to work in my
situation.

Any guidance and /or sample VB code anybody can offer would be very
much appreciated.


Thanks

Mark M