Thread View: borland.public.cppbuilder.database.ado
4 messages
4 total messages
Started by sam
Tue, 13 Feb 2007 12:56
Null Values SQL2005 New to builder
Author: sam
Date: Tue, 13 Feb 2007 12:56
Date: Tue, 13 Feb 2007 12:56
7 lines
964 bytes
964 bytes
What is the best way to handle nulls with BCB6 with MSSQL 2005. Every time the code hits a null it throws a exception or crashes the program. TIA Sam
Re: Null Values SQL2005 New to builder
Author: Clayton Arends
Date: Tue, 13 Feb 2007 23:59
Date: Tue, 13 Feb 2007 23:59
5 lines
1085 bytes
1085 bytes
Can you give an example of where the program crashes? The exceptions I have seen usually happen when attempting to convert a null Variant to string. Do you have other crashes happening to you? - Clayton
Re: Null Values SQL2005 New to builder
Author: sam
Date: Wed, 14 Feb 2007 03:21
Date: Wed, 14 Feb 2007 03:21
17 lines
1323 bytes
1323 bytes
Same problem I am new to user of builder 6 What is the best way to handle this? TIA Sam "Clayton Arends" <nospam_claytonarends@hotmail.com> wrote in message news:45d250e9$1@newsgroups.borland.com... > Can you give an example of where the program crashes? The exceptions I > have seen usually happen when attempting to convert a null Variant to > string. Do you have other crashes happening to you? > > - Clayton >
Re: Null Values SQL2005 New to builder
Author: Clayton Arends
Date: Wed, 14 Feb 2007 04:02
Date: Wed, 14 Feb 2007 04:02
19 lines
1623 bytes
1623 bytes
It depends on what you want to do with null data. If you want to treat
nulls as some value you can use VarToStr() or VarToStrDef(). Look them up
in the help for more info.
If you want to handle nulls differently then you can do something like this
whenever evaluating the field's value:
String strValue;
if (field->Value.IsNull())
// do some condition
else
strValue = field->Value; // or field->AsString;
Check out the help for TField and Variant for more info.
If you have a specific code example or a specific design question post it
and I'll try my best to help.
- Clayton
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads