issue for add parameter from code

Stimulsoft Reports.WPF discussion
Post Reply
kuma
Posts: 11
Joined: Fri Feb 21, 2014 2:09 pm

issue for add parameter from code

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: issue for add parameter from code

Post 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.
kuma
Posts: 11
Joined: Fri Feb 21, 2014 2:09 pm

Re: issue for add parameter from code

Post 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
Alex K.
Posts: 6488
Joined: Thu Jul 29, 2010 2:37 am

Re: issue for add parameter from code

Post by Alex K. »

Hello,

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