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

Stimulsoft Reports.WPF discussion
Post Reply
jacek_arwal
Posts: 17
Joined: Mon Mar 04, 2019 12:01 pm

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

Post 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
    }
}
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

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

Post by Lech Kulikowski »

Hello,

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

Thank you.
jacek_arwal
Posts: 17
Joined: Mon Mar 04, 2019 12:01 pm

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

Post by jacek_arwal »

I'm using stimulsoft bundled in insert nexo package, report attached.
Attachments
Raport o środkach trwałych nieumarzanych.mrt
(69 KiB) Downloaded 227 times
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

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

Post by Lech Kulikowski »

Hello,

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

Thank you.
jacek_arwal
Posts: 17
Joined: Mon Mar 04, 2019 12:01 pm

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

Post 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
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

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

Post by Lech Kulikowski »

Hello,

In the edit data source window.

Thank you.
Attachments
Annotation 2019-03-05 122516.jpg
Annotation 2019-03-05 122516.jpg (119.71 KiB) Viewed 4592 times
jacek_arwal
Posts: 17
Joined: Mon Mar 04, 2019 12:01 pm

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

Post by jacek_arwal »

Thanks , this was a reason :D
Lech Kulikowski
Posts: 6197
Joined: Tue Mar 20, 2018 5:34 am

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

Post by Lech Kulikowski »

Hello

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

Thank you.
Post Reply