How to fix "Must declare the variable" with FirebirdSql.EntityFrameworkCore.Firebird

-1

I'm having some trouble with "FirebirdSql.EntityFrameworkCore.Firebird" and "FirebirdSql.Data.FirebirdClient" in an AspNetCore.App.

I'm encountering some kind of random exception

Failed executing DbCommand ("38"ms) [Parameters=["@p0='32635', @p1='2034658' (Size = 30), @p2='3401320346583' (Size = 30), @p3='ml' (Size = 30), @p4='150' (Nullable = true), :p5='', :p6='3596490003630' (Size = 30), :p7='1866', :p8='SOMATOLINE COSMETIC CR 1ERE CELL DRAIN 150ML' (Size = 50), @p9='None' (Nullable = false) (Size = 30), @p10='32.9' (Nullable = true), @p11='219.333333333333' (Nullable = true), @p12='-1', @p13='0', @p14='1', @p15='0', @p16='Produit' (Nullable = false) (Size = 30), @p17='0', @p18='F7061975' (Size = 30), @p19='CaducielDefaultV2.xsl' (Size = 30), @p20='True', @p21='True', @p22='True'"], CommandType='Text', CommandTimeout='30']" ""INSERT INTO \"ESL_LABEL_ACTION_DATA\" (\"ACTION_ID\", \"ARTICLE_CIP\", \"ARTICLE_CIP13\", \"ARTICLE_CONTENT_UNIT\", \"ARTICLE_CONTENT_VALUE\", \"ARTICLE_DISCOUNTED_PRICE\", \"ARTICLE_EAN13\", \"ARTICLE_ID\", \"ARTICLE_NAME\", \"ARTICLE_PREGNANCY_WARNING\", \"ARTICLE_PRICE\", \"ARTICLE_PRICE_PER_UNIT\", \"ARTICLE_PRICE_VALIDITY\", \"ARTICLE_QTY_AWAITING_RECEIPT\", \"ARTICLE_QTY_IN_STOCK\", \"ARTICLE_QTY_ORDERED\", \"ARTICLE_TYPE\", \"LABEL_ORIENTATION\", \"LABEL_PROVIDER_IDENTIFIER\", \"LABEL_TEMPLATE\", \"OPTION_DISPLAY_DATAMATRIX\", \"OPTION_DISPLAY_PREGNANCY_WARN\", \"OPTION_DISPLAY_STOCK\") VALUES (@p0, @p1, @p2, @p3, @p4, @p5, @p6, @p7, @p8, @p9, @p10, @p11, @p12, @p13, @p14, @p15, @p16, @p17, @p18, @p19, @p20, @p21, @p22);" (627a98df) FirebirdSql.Data.FirebirdClient.FbException (0x80004005): Must declare the variable '@p5' at FirebirdSql.Data.FirebirdClient.FbCommand.UpdateParameterValues() in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:line 969 at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteCommand(CommandBehavior behavior, Boolean returnsSet) in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:line 1175 at FirebirdSql.Data.FirebirdClient.FbCommand.ExecuteReader(CommandBehavior behavior) in C:\Users\Jiri\Documents\devel\NETProvider\working\Provider\src\FirebirdSql.Data.FirebirdClient\FirebirdClient\FbCommand.cs:line 502 at System.Data.Common.DbCommand.ExecuteDbDataReaderAsync(CommandBehavior behavior, CancellationToken cancellationToken)

It's not appening on every insert request on this table, doesn't seems to be caused by parameter values, it's not always the same parameter. But every time this exception occur, the parameter is named with ':pX' but expected to be '@pX'.

Does anyone have encounter this issue ?

c#
.net-core
firebird
asked on Stack Overflow May 29, 2019 by user11571847 • edited May 29, 2019 by Prasad Telkikar

1 Answer

0

i have same problem. we can see in the function UpdateParameterValues() of the file FbCommand. the parameter is not found because this name is different.

_namedParameters : have 7 parameters with @

Parameters : The last two parameters have start with ":"

answered on Stack Overflow Jun 26, 2019 by user11702183

User contributions licensed under CC BY-SA 3.0