Page 1 of 1

error SqlCommand.Prepare method requires all parameters ... with text parameter

Posted: Mon Mar 04, 2019 12:24 pm
by jacek_arwal
I have a text parameter in my mssql query and it causes an error:
SqlCommand.Prepare method requires all parameters to have an explicitly set type
I found a solution:

Code: Select all

report.Dictionary.DataSources["DataSourceName"].Parameters["ParameterName"].Value = ""
But I don't kno where to put this code

My report code is now:

Code: Select all

using System;
using System.Drawing;
using System.Windows.Forms;
using System.Data;
using Stimulsoft.Controls;
using Stimulsoft.Base.Drawing;
using Stimulsoft.Report;
using Stimulsoft.Report.Dialogs;
using Stimulsoft.Report.Components;
using System.Linq;
using InsERT.Moria.Wydruki;

namespace Reports
{
    public class EwidencjaSrodkowTrwalych : Stimulsoft.Report.StiReport
    {
        private IFunkcjaPobieraniaDanychDlaWydruku PobierzFunkcje(string nazwa)
        {            return MenedzerFunkcjiPobieraniaDanychDlaWydruku.PobierzFunkcje(nazwa);
        }

        private IFunkcjaPobieraniaDanychDlaWydruku PobierzFunkcje(Guid id)
        {
            return MenedzerFunkcjiPobieraniaDanychDlaWydruku.PobierzFunkcje(id);
        }

        public EwidencjaSrodkowTrwalych()        {
            this.InitializeComponent();
 			/// StiOptions.Engine.GlobalEvents
        }

        #region StiReport Designer generated code - do not modify
		#endregion StiReport Designer generated code - do not modify
    }
}

Re: error SqlCommand.Prepare method requires all parameters ... with text parameter

Posted: Mon Mar 04, 2019 9:21 pm
by Lech Kulikowski
Hello,

Please send us your report which reproduces the issue for analysis.

Thank you.

Re: error SqlCommand.Prepare method requires all parameters ... with text parameter

Posted: Tue Mar 05, 2019 6:49 am
by jacek_arwal
I'm using stimulsoft bundled in insert nexo package, report attached.

Re: error SqlCommand.Prepare method requires all parameters ... with text parameter

Posted: Tue Mar 05, 2019 9:21 am
by Lech Kulikowski
Hello,

You should set Size property for the @NrInw Text parameter.

Thank you.

Re: error SqlCommand.Prepare method requires all parameters ... with text parameter

Posted: Tue Mar 05, 2019 11:09 am
by jacek_arwal
How can I set it ? In parameter window I can only choose type of this property ( I choosed text ) , but not a size

Re: error SqlCommand.Prepare method requires all parameters ... with text parameter

Posted: Tue Mar 05, 2019 11:26 am
by Lech Kulikowski
Hello,

In the edit data source window.

Thank you.

Re: error SqlCommand.Prepare method requires all parameters ... with text parameter

Posted: Wed Mar 06, 2019 1:18 pm
by jacek_arwal
Thanks , this was a reason :D

Re: error SqlCommand.Prepare method requires all parameters ... with text parameter

Posted: Wed Mar 06, 2019 6:30 pm
by Lech Kulikowski
Hello

We are always glad to help you!
Please let us know if you need any additional help.

Thank you.