BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Null Values SQL2005 New to builder

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO)
View previous topic :: View next topic  
Author Message
sam
Guest





PostPosted: Tue Feb 13, 2007 6:56 pm    Post subject: Null Values SQL2005 New to builder Reply with quote



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
Back to top
Clayton Arends
Guest





PostPosted: Wed Feb 14, 2007 5:59 am    Post subject: Re: Null Values SQL2005 New to builder Reply with quote



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
Back to top
Clayton Arends
Guest





PostPosted: Wed Feb 14, 2007 9:10 am    Post subject: Re: Null Values SQL2005 New to builder Reply with quote



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
Back to top
sam
Guest





PostPosted: Wed Feb 14, 2007 9:10 am    Post subject: Re: Null Values SQL2005 New to builder Reply with quote

Same problem
I am new to user of builder 6
What is the best way to handle this?

TIA

Sam


"Clayton Arends" <nospam_claytonarends (AT) hotmail (DOT) com> wrote in message
news:45d250e9$1 (AT) newsgroups (DOT) borland.com...
Quote:
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
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.