|
-
October 24th, 2001, 09:00 PM
#1
Check Null Value
I do the following code:
_varian_t vValue;
long l;
vValue=pRecordset->Fields->GetItem(_variant_t(0L))->Value;
l=atol((char *)(_bstr_t)vValue);
but when I reach to a record have NULL value in this field, this code will cause an error.
So any body tell me how can I check the vValue was NULL before I call atol function.
Thanks so much.
Khinlau
-
October 25th, 2001, 02:37 AM
#2
Re: Check Null Value
You can simply go
if(pRecordset->Fields->GetItem(_variant_t(0L))->Value!=NULL)
{vValue=pRecordset->Fields->GetItem(_variant_t(0L))->Value;
}
-
October 25th, 2001, 05:56 AM
#3
Re: Check Null Value
are you sure that code run well?
I can not compile the code if(pRecordset... !=NULL)
and you note that this recordset I use ADO.
Thanks so much for you help
Khinlau
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|