Hi!  This is my first post to the list.  I've tried to trim it down to
what seems the most relevant.

I am having a problem inserting into my database using the Firebird .NET
provider.  I am using Visual Studio .NET 2003 SP1 and thus the .NET
provider 1.7 and Firebird 1.5, and I am coding in Managed C++.

My table has two 1-character fields to store boolean values:

   CREATE TABLE FSBSRun (
       ...
       Maintenance CHAR NOT NULL,
       Availability CHAR NOT NULL,
       ...
   )

I fill the parameters in my query and display a MessageBox to make sure
the values are OK:

   // run.maintenance and run.availability are bool fields of a struct
   command->Parameters->Add(S"@maint", __box(run.maintenance));
   command->Parameters->Add(S"@avail", __box(run.availability));

   // Display parameters to verify they were set correctly
   System::Text::StringBuilder* message = new
System::Text::StringBuilder;
   for (int i = 0; i < command->Parameters->Count; ++i) {
       message->Append(command->Parameters->Item[i]);
       message->Append(S": ");
       message->Append(command->Parameters->Item[i]->Value);
       message->Append(S"\n");
   }
   System::Windows::Forms::MessageBox::Show(message->ToString());

   command->ExecuteNonQuery();

The contents of the displayed MessageBox show the following values for
the parameters:

   @maint: False
   @avail: False

However, when it gets to the "command->ExecuteNonQuery();" call, I get
the following exception:

   arithmetic exception, numeric overflow, or string truncation

However, inserting the same values manually using the ISQL tool works
fine when I just use 'F' instead of 'False', so I do not think it is a
problem with the other (unlisted) parameters.  When I use 'False' for
those parameters in ISQL, I get the same exception.

I tried creating temporary char variables instead of using the bool
values directly:

   char maint = (run.maintenance) ? 'T' : 'F';
   command->Parameters->Add(S"@maint", __box(maint));

   char avail = (run.availability) ? 'T' : 'F';
   command->Parameters->Add(S"@avail", __box(avail));

but I still get the same exception.

Any ideas where to start looking for my error?  I'm pretty new to
Firebird and database programming in general.  If I've left out any
relevant information, please let me know.

Thanks,
Marcus

-- 
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

Reply via email to