-
April 23rd, 2013, 03:09 AM
#1
[C++ ADO- SQL] pFields->GetItem (index)->GetValue () - throws an exception when field
Hey ho!
I'm using ADO to link my WinAPI app with MS Access (SQL statements).
All works perfectly - without any problems i can read and write to the db (although i find ADO itself a bit annoying and painful :-) )
Anyways, there is one problem i cannot really deal with by myself anymore, when i read the fields from pField and when the particular field is empty (blank) then following throws the exception:
pFields->GetItem(nIndex)->GetValue())
Obviously i can somehow handle this using try / catch (_com_error & ) but i rather not do that coz i use try/catch to catch "real" errors.
Forcing the user to always fill all fields in is also nothing i want to do coz with a massive amount of data he/she needs to enter, doing this for non mandatory fields would be very painful and simply pointless. So when i read the db and some fields are empty i just wanna get the pointer to the empty string ('\0'):
_bstr_t jakisstring = _bstr_t(pFields->GetItem(nIndex)->GetValue());
but as i mentioned the app immediately throws the error
any ideas?
I know there's been a threat for this already:
http://forums.codeguru.com/printthread.php?t=182988
but it does not seem it's been addressed, so here i am posting this once again myself.
berkov
.
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
|