Working with crystlreport in vs2008 ,have created two paramers fields using designer and
also generated formula in formula editor :
{cashtbl.StdID} = {?stdid} or{cashtbl.ExamId} = {?examid}
I have written code on buttonclick events to see values as per stdid or examid parametrfields mapped it with two textboxes,from cashtbl
the code gives error at runtime when selecting examid from textbox2:The types of the parameter field and parameter field current values are not compatible.
my code in button is:

ParameterFieldDefinitions parafields1;
            ParameterFieldDefinition parafeild1;
            ParameterFieldDefinitions parafields2;
            ParameterFieldDefinition parafeild2;
            ParameterValues values1 = new ParameterValues();
            ParameterValues values2 = new ParameterValues();
            ParameterDiscreteValue discretevalue1 = new ParameterDiscreteValue();
            ParameterDiscreteValue discretevalue2 = new ParameterDiscreteValue();
            discretevalue1.Value = textBox1.Text;
            discretevalue2.Value = textBox2.Text;
            parafields1 = crystalReport11.DataDefinition.ParameterFields;
            parafeild1 = parafields1["stdid"];
            values1 = parafeild1.CurrentValues;
             parafields2 = crystalReport11.DataDefinition.ParameterFields;
            parafeild2 = parafields2["examid"];
            values2 = parafeild2.CurrentValues;
            crystalReportViewer1.ReportSource = crystalReport11;

why is not showing records as per second parameter i.e examid?
pls help

Edited 4 Years Ago by __avd: Added [code] tags.

give aprapriate code

Your code is really confusing. But I suspect that your error is caused by setting a string to an number or vice versa. Determine the data types of all those fields (maybe give them more meaningful names too). Compare these types to what you are providing them - in this case it looks like the 2 values are coming in as strings from 2 textboxes. Make sure both stid and examid are being passed numbers (probably int32s) rather than strings (the .Text field of a textbox) if they are in fact numeric datatypes.

This article has been dead for over six months. Start a new discussion instead.