Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.server -> Re: Oracle's OLE DB/OValue/C++

Re: Oracle's OLE DB/OValue/C++

From: steven <rgc_at_newsguy.com>
Date: Sat, 21 Jul 2001 21:33:10 GMT
Message-ID: <db4rkt834g8a0l8dvrci198c2g3avkf4o7@4ax.com>

Thank you very much, that worked perfectly.

On Thu, 12 Jul 2001 10:02:41 +0200, "Boris Bunjan" <boris.bunjan_at_zg.hinet.hr> wrote:

>
>"steven" <rgc_at_newsguy.com> wrote in message
>news:rccqktsf7hht1svpdjkpt92a646gq7ftud_at_4ax.com...
>> I am reading fields in an Oracle Table using Oracle's OLE DB/C++
>> oracl.h that are of VARCHAR2(30). I have read the first 4 fields just
>> fine, but the fifth field errors when i try to convert it to a string.
>> Most of the data is like '10 FEB 2001' the rest are blank. The project
>> is a ISAPI Extension.
>>
>> OValue vmyDate;
>> string smyDate;
>> omyTable.GetFieldValue("MYDATE", &vmyDate);
>> smyDate = vmyDate;
>>
>> IsNull is TRUE for all rows including those that have data, the other
>> fields that are populated are not NULL.
>>
>> Any Ideas?
>> steven
>
>smyDate = vmyDate; is effectivly smyDate = (const char*)vmyDate;
>and (const char*)vmyDate returns C++ NULL pointer for database null values,
>and you end up with
>smyDate = (const char*)NULL; whitch will throw exception.
>
>So you'll have to test value for null, something like
>smyDate = (vmyDate.IsNull() ? "" : (const char*)vmyDate);
>or use try-catch mechanism.
>
>BTW. You're using Oracle Objects for OLE, not OLEDB
>
>Regards,
>Boris
>
Received on Sat Jul 21 2001 - 16:33:10 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US