Thanks for the info
I will do some test with a SMALLINT field.

Happy coding
Chris
> -----Ursprüngliche Nachricht-----
> Von: Геннадий Забула [mailto:zabulu...@gmail.com]
> Gesendet: Freitag, 26. Juni 2015 15:11
> An: christian.waldm...@rte-ag.ch; For users and developers of the
> Firebird .NET providers
> Betreff: Re: [Firebird-net-provider] Handling of boolean in .Net
> Provider 4.6.2
> 
> We are using SMALLINT type in our project.
> FB EF provider also generates tables with SMALLINT fields for code-
> first class fields.
> 
> On 26 June 2015 at 14:49, Christian Waldmann <christian.waldmann@rte-
> ag.ch> wrote:
> > I am using Firebird 2.5.4, superServer and embedded, Visula Studio
> > 2013, .Net Framework 4.5.1, .Net Provider 4.6.2
> >
> >
> //====================================================================
> > ======
> > =================
> > I have defined a table with "CyclePassed" CHAR(1) to store a boolean
> > result
> >
> > CREATE TABLE "SampleSummaries" (
> >     "UniqueId"            BIGINT DEFAULT 0 NOT NULL,
> >     "EndTestRunId"        BIGINT NOT NULL,
> >     "Cycle"               BIGINT NOT NULL,
> >     "LoadPressure"        FLOAT,
> >     "LoadPressureMin"     FLOAT,
> >     "LoadPressureMax"     FLOAT,
> >     "ShutoffPressure"     FLOAT,
> >     "ShutoffPressureMin"  FLOAT,
> >     "ShutoffPressureMax"  FLOAT,
> >     "TravelTime"          FLOAT,
> >     "TravelTimeMin"       FLOAT,
> >     "TravelTimeMax"       FLOAT,
> >     "CyclePassed"         CHAR(1)
> > );
> >
> >
> >
> //====================================================================
> > ======
> > =================
> > // access to table from C#
> >
> > bool cyclePassed = true;
> > FbCommand command = new FbCommand();
> >
> > command.CommandText =
> >         "INSERT INTO \"SampleSummaries\" (" +
> >       "\"EndTestRunId\", \"Cycle\", " +
> >       "\"LoadPressure\", \"LoadPressureMin\", \"LoadPressureMax\", "
> +
> >       "\"ShutoffPressure\", \"ShutoffPressureMin\",
> > \"ShutoffPressureMax\", " +
> >       "\"TravelTime\", \"TravelTimeMin\", \"TravelTimeMax\",
> > \"CyclePassed\"" +
> >       ") VALUES  (@EndTestRunId, @Cycle, " +
> >       "@LoadPressure, @LoadPressureMin, @LoadPressureMax, " +
> >       "@ShutoffPressure, @ShutoffPressureMin, @ShutoffPressureMax," +
> >       "@TravelTime, @TravelTimeMin, @TravelTimeMax, @CyclePassed )";
> >
> > command.Connection = samplesTableAdapter.Connection;
> > command.Transaction = transaction;
> >
> > command.Parameters.Add("@EndTestRunId", FbDbType.BigInt).Value =
> channelId;
> >             ...
> >
> > // PROBLEM A:
> >
> ======================================================================
> > ======
> > ==============
> > // works with stand alone server,
> > // but SQL error "string conversion error '49'"
> > // {Remark: 49 is the decimal ASCII code of '1'}
> > command.Parameters.Add("@CyclePassed", FbDbType.Boolean).Value =
> > cyclePassed ? '1' : '0';
> >
> > // PROBLEM B:
> >
> ======================================================================
> > ======
> > ==============
> > // works with embedded server,
> > // but "string truncation error" with stand alone server
> > command.Parameters.Add("@CyclePassed", FbDbType.Boolean).Value =
> > cyclePassed;
> >
> > // REMARK:
> >
> ======================================================================
> > ======
> > ==============
> > // works with embedded server and standalone server Firebird 2.5.3,
> > with .Net Provider 2.0, .Net Framework 2.0, Visual Studio 2008
> > command.Parameters.Add("@CyclePassed", FbDbType.Boolean).Value =
> > cyclePassed;
> >
> > // QUESTION
> >
> ======================================================================
> > ======
> > ================
> > Is this a bug or am I missing the correct usage of storing a 'bool'?
> >
> > Happy coding
> > Christian Waldmann
> >



------------------------------------------------------------------------------
Monitor 25 network devices or servers for free with OpManager!
OpManager is web-based network management software that monitors 
network devices and physical & virtual servers, alerts via email & sms 
for fault. Monitor 25 devices for free with no restriction. Download now
http://ad.doubleclick.net/ddm/clk/292181274;119417398;o
_______________________________________________
Firebird-net-provider mailing list
Firebird-net-provider@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/firebird-net-provider

Reply via email to