Subject RE: [IBO] TIB_Query->Insert throws on non-NULL fields
Author Norman Dunbar
David,

I've always found that Delphi/C++ Builder throws that exception (xxx is a
required field) if a field is defined on the database as not null.

For those fields where I don't want my user (ie me) entering something on a
form, I shove a value into the fields in the BeforePost handler for the
query - checking to make sure that the dataset is in the correct mode
(dssInsert) if appropriate.

For those fields that I do want my user to fill in, I set the
ColumnAttributes property to make them required fields. (This also applies
if I have fields that can be null in the database but I don't want nulls
going over - I know, a design error, but it happens !)

Alternatively, I can set CheckRequired to false and not bother about what
hits the database because the database will throw an exception if I pass
nulls over to not null fields and I don't have a trigger to sort out a
value.

Not sure if that was helpful or not :o)

Cheers,
Norman.

-------------------------------------
Norman Dunbar
Database/Unix administrator
Lynx Financial Systems Ltd.
mailto:Norman.Dunbar@...
Tel: 0113 289 6265
Fax: 0113 289 3146
URL: http://www.Lynx-FS.com
-------------------------------------


-----Original Message-----
From: tickerboo2002 <support@...>
[mailto:support@...]
Sent: Thursday, January 30, 2003 1:47 PM
To: IBObjects@yahoogroups.com
Subject: [IBO] TIB_Query->Insert throws on non-NULL fields


This used to work and I'm fairly sure I haven't changed any of the
TIB_Query properties.

Using the default TIB_Query properties, I call:

qry->Insert();

IBO throws an exception warning me that:

"myfieldname is a required field"

Tracing into Insert() it goes into SysInsert, SysPost and finally
CheckRequiredFields where the exception is thrown.

I know I can set CheckRequired=false, but I want this to check the
params when I've finished editing the row.

None of my other queries throw on non-null fields when I insert a row.

Any ideas?

TIA

David






___________________________________________________________________________
IB Objects - direct, complete, custom connectivity to Firebird or InterBase
without the need for BDE, ODBC or any other layer.
___________________________________________________________________________
http://www.ibobjects.com - your IBO community resource for Tech Info papers,
keyword-searchable FAQ, community code contributions and more !

Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/

This email is intended only for the use of the addressees named above and
may be confidential or legally privileged. If you are not an addressee you
must not read it and must not use any information contained in it, nor copy
it, nor inform any person other than Lynx Financial Systems or the
addressees of its existence or contents. If you have received this email
and are not a named addressee, please delete it and notify the Lynx
Financial Systems IT Department on 0113 2892990.