-
September 1st, 2005, 09:34 AM
#1
reading database with ADOB
i tried this code to read from access DB
and when i access a cell that is empty and not null with this code :
PHP Code:
name =_strdup((char*) ((_bstr_t)(pConnectRead->GetFields()->GetItem("name")->GetValue())) );
then i get an error : type mismatch
why is that?
thnaks in advance
peleg
-
September 1st, 2005, 10:18 AM
#2
Re: reading database with ADOB
Originally Posted by pelegk2
i tried this code to read from access DB
and when i access a cell that is empty and not null with this code :
PHP Code:
name =_strdup((char*) ((_bstr_t)(pConnectRead->GetFields()->GetItem("name")->GetValue())) );
then i get an error : type mismatch
why is that?
thnaks in advance
peleg
Try this:
COleVariant Var;
Var = recordset->Fields->GetItem("FirstName")->Value;
firstName = ( Var.vt == VT_NULL ? _T("") : ((char *) (_bstr_t)Var.bstrVal) );
This above code definitely works.
Hope this helps.
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
|