Login ProductsSalesSupportDownloadsAbout |
Home » Technical Support » ElevateDB Technical Support » Support Forums » ElevateDB General » View Thread |
Messages 1 to 3 of 3 total |
Awkward problem with Integer fields and NULLs |
Wed, Oct 2 2013 12:28 PM | Permanent Link |
Adam Brett Orixa Systems | There is a relationship between 2 tables:
ID in table 1 is referenced by SomeTableID in table 2. If SomeTableID is NULL, or contains a value which is in Table 1 everything is fine. If SomeTableID has another value EDB (quite rightly) gives a referential integrity error. My problem is that I have a delphi component (lookup) which shows a list of Text entries, while holding an Integer behind the scenes. It is a DB Control. This allows me to easily show the "Looked-up" value while the DBField is just the Integer. If the field is NULL the lookup works fine, showing blank. However, if the user selects one item, and then realises that none is valid it is impossible to create a NULL. I have created a blank text entry in the list with an associated integer of -1. I would like to be able to pass this back to the database and _somehow_ convert it to a NULL along the way. Is this possible? I've tried, but Delphi doesn't seem to allow me to pass NULL to my Query.FieldByName('').asInteger ... and I can't think of another way to do it. |
Wed, Oct 2 2013 4:14 PM | Permanent Link |
Chris Clark | I suspect Query.FieldByName('').Clear Might do it.
Never done it for an Integer field, but it works for string fields (EDB Guid type) which I use for Key fields setting the string to '' gives a similar problem. |
Thu, Oct 3 2013 6:24 AM | Permanent Link |
Adam Brett Orixa Systems | Chris
Genius ... thanks that does the trick. |
This web page was last updated on Saturday, April 27, 2024 at 08:52 PM | Privacy PolicySite Map © 2024 Elevate Software, Inc. All Rights Reserved Questions or comments ? E-mail us at info@elevatesoft.com |