Page 1 of 1

issue for add parameter from code

Posted: Mon Feb 24, 2014 9:09 pm
by kuma
Hi, my name is fabio and here I am new and I try this software for my company.

I build a report and I need add one or more parameters at runtime:

this is my code:

Code: Select all

                        rep.Dictionary.DataSources[indexDS].Parameters.Add(new StiDataParameter()
                        {
                            Name = name,
                            DataSource = rep.Dictionary.DataSources[indexDS],
                            ParameterValue = value
                        });                        
but this is not work fine.

message error:"exceps the parameter '@p1', which was not supplied."

can you help me?

thanks
Fabio

Re: issue for add parameter from code

Posted: Tue Feb 25, 2014 7:06 am
by Alex K.
Hello,

Can you please describe your issue in more details. Also please send us a sample which reproduce the issue for analysis.

Thank you.

Re: issue for add parameter from code

Posted: Tue Feb 25, 2014 8:49 am
by kuma
ok, I fix it :)

this is my new code:

Code: Select all

            (rep.Dictionary.DataSources[0] as Stimulsoft.Report.Dictionary.StiSqlSource).AddParameter("@p1", "", System.Data.SqlDbType.Decimal, 18);
            rep["@p1"] = 5d;

            var source = (rep.Dictionary.DataSources[0] as Stimulsoft.Report.Dictionary.StiSqlSource);
            source.SqlCommand = string.Format("{0} {1}", source.SqlCommand, " where pvendpub<=@p1");
thank you

Re: issue for add parameter from code

Posted: Tue Feb 25, 2014 10:48 am
by Alex K.
Hello,

Ok.
Let us know if you need any additional help.