Joseph Krausz
asked on
Trap dbnull in OledbCommand ExecuteScalar
Hi,
i am trying to connect to a table in access combining a few fields including a currency field, seems to be when asking for the currency field but having no vaklue it returns a DBnull Exception, so my question is how i can parse the field before sending it and howi can get over it,
thanks in advance,
i am trying to connect to a table in access combining a few fields including a currency field, seems to be when asking for the currency field but having no vaklue it returns a DBnull Exception, so my question is how i can parse the field before sending it and howi can get over it,
thanks in advance,
ASKER
this will not work as the sql command includes a few fields including non decimal field so my question is if its possible to parse or trap before executing the sql like nz(amount,0) in access, or it does not have any functions to trap
Can you show your query?
ASKER
I oriented myself that using parameters in the SQL string instead of just field names will help me but still didn't tested,
As I'm not so familiar with it please help me out
SQL= "select firstname+' ' +lastname+' '+amount from members";
I assume to use the oledbparameters class to assign the field name after testing the value
So should be like select@firstname...
But I can still use some help for completing it
Thanks.
As I'm not so familiar with it please help me out
SQL= "select firstname+' ' +lastname+' '+amount from members";
I assume to use the oledbparameters class to assign the field name after testing the value
So should be like select@firstname...
But I can still use some help for completing it
Thanks.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
e.g.
Open in new window