> -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > On Behalf Of Dean Harding > Sent: Monday, November 06, 2006 18:07 > To: 'For users and developers of the Firebird .NET providers' > Subject: Re: [Firebird-net-provider] Problem Inserting > Boolean Values asCharsinto DB > > > So, instead of: > > > command->Parameters->Add(S"@maint", __box(run.maintenance)); > > command->Parameters->Add(S"@avail", __box(run.availability)); > > Try: > > String __gc* maint = (run.maintenance ? S"T" : S"F"); > command->Parameters->Add(S"@maint", maint); > > String __gc* avail = (run.availability ? S"T" : S"F"); > command->Parameters->Add(S"@avail", avail);
Thanks, this did the trick! > However, I would question the value of using a CHAR data type > here. You might want to try a SMALLINT or something and set to 0 or 1. Initially, I was messing around with IBPP (until I discovered that it does not play well with Managed C++, at which point they recommended the .NET provider to me) and they used this convention, and it would automatically convert between bool and char, so I just assumed it was something built-in to Firebird (as I said, I'm still kind of new at this): [quote from http://www.ibpp.org/reference/conversions] You can store and read a bool to/from a CHAR or VARCHAR. Here is the mapping that will happen in such case. * Writing a bool to a CHAR : a leading 'T' or 'F' (true or false) will be written, other characters set to ' ' (space) * Writing a bool to a VARCHAR : a leading 'T' or 'F' will be written and the VARCHAR content length set to 1 character * Reading a bool from a CHAR : if the leading character is any of 't', 'T', 'y', 'Y', or '1', store a true, else a false * Reading a bool from a VARCHAR : if the leading character is any of 't', 'T', 'y', 'Y', or '1', store a true, else a false [end quote] Would this be something that might be considered as a useful feature for people and a possible enhancement to the .NET provider? I will consider your suggestion to switch to SMALLINT. Thanks! -- Marcus Kwok <[EMAIL PROTECTED]> Johns Hopkins University Applied Physics Laboratory, AISD VIA Group Office: 13-N520 Phone: (443) 778-7858 (Baltimore) or (240) 228-7858 (DC) ------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642 _______________________________________________ Firebird-net-provider mailing list Firebird-net-provider@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/firebird-net-provider