Operation Illegal on Linked Parameters C# and .Net

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kurtzky
    New Member
    • Nov 2008
    • 26

    Operation Illegal on Linked Parameters C# and .Net

    Hello. Good day. I have this problem with my current program right now. I have a separate report created in Seagate Crystal Reports, and I'm integrating it to my program in C#.

    I'm using CrystalDecision s and calls the ReportDocument class.

    Under that report, I have many subreports. What I want to do is to select ALL the fields in the MAIN report and put it in the DataTable, then I would put that DataTable as the DataSource of my ReportDocument. The problem is, when I set a value to any of my subreport parameters, I am getting an error "Operation Illegal on Linked Parameters".. Any help? Thanks!
  • kurtzky
    New Member
    • Nov 2008
    • 26

    #2
    ok this is my code snippet, just to elaborate my problem above, which is the Operation Illegal on Linked Parameter. I use this logic in order to load my report faster:


    =============== =============== =============== =========

    DataTable dtQuery = new DataTable();
    ReportDocument rdt = new ReportDocument( );
    rdt.Load(@"C:\R eports\Items.rp t");

    string sql = "SELECT order_no, supplier_no, item_no, qty FROM Items WHERE order_no IN IN ('" + ord_no + "') "; //ord_no is a string, contains the order numbers to be printed, example is ord_no = (''1234', '3432', '2346');
    dtQuery = Database.GetDat aTable("Server1 ", sql); //GetDataTable is a function under Database class, Server1 sample name only
    rdt.SetDataSour ce(dtQuery);
    rdt.SetParamete rValue("OrderNo ", arr); //arr is an array, so it's possible to have many OrderNo to be printed in the report; this is the Main report's parameter

    ParameterDiscre teValue paramDiscreteVa lue = new ParameterDiscre teValue();
    DataDefinition DataDef = rdt.DataDefinit ion;
    ParameterFieldD efinitions pm = DataDef.Paramet erFields;
    ParameterFieldD efinition Param1; //Param1 & Param2 are my subreport parameters
    ParameterFieldD efinition Param2;
    for (int i = 0; i < dtQuery.Rows.Co unt; i++)
    {
    Param1 = pm["Pm-supplier_no", "Supplier"]; //Supplier is a subreport
    paramDiscreteVa lue.Value = dtQuery.Rows[i]["supplier_n o"].ToString();
    Param1.CurrentV alues.Add(param DiscreteValue);
    Param1.ApplyCur rentValues(Para m1.CurrentValue s);

    Param2 = pm["Pm-item_no", "ItemDesc"]; //ItemDesc is another subreport which takes item_no as the parameter
    paramDiscreteVa lue.Value = dtQuery.Rows[i]["item_no"].ToString();
    Param2.CurrentV alues.Add(param DiscreteValue);
    Param2.ApplyCur rentValues(Para m2.CurrentValue s);
    }

    =============== =============== =============== =========

    Notes:
    - In my Supplier subreport, I have a parameter called Pm-supplier_no. This is the link to the MAIN report's supplier_no field. This subreport will display all the supplier details. In this subreport's Record Selection, I have SupplierTable.s upplier_no = {?Pm-supplier_no}

    - In my ItemDesc subreport, I have also a parameter called Pm-item_no. This is another link to the MAIN report's item_no. This subrepot will display all the item details. The reason why I have a for loop is that it's possible to have many items in the main report, so I have to pass also the exact number of items to its subreport. In this subreport's Record Selection, I have ItemTable.item_ no = {?Pm-item_no}.


    Thanks a lot! Any help will be appreciated!
    Last edited by kurtzky; Mar 1 '10, 11:34 PM. Reason: typographical error

    Comment

    Working...