You've got a number of choices about how to deal with this issue.
The first thing to do is investigate the methods exposed by the
OdbcDataReader class.
The IsDBNull and GetString methods jump out immediately and used in
conjunction with the String.Trim and String.IsNullOrEmpty methods you should
be able to develop a very robust handler.
"cj2" <cj2@nospam.nospamwrote in message
news:OLTyiMCTJHA.1160@TK2MSFTNGP02.phx.gbl...
Quote:
isdbnull reports false when the field is = "" or " ". What I was trying
to say when I said "when a field is something other than a value" was I
don't consider "" or " " a value.
>
> zacks@construction-imaging.com wrote: Quote:
>On Nov 21, 2:43 pm, cj2 <c...@nospam.nospamwrote: Quote:
>>if myodbcreader.hasrows then
>> if myodbcreader("code").trim = "" or myodbcreader("reas").trim =
>>"aVAL"
>>then
>> do something
>> endif
>>endif
>>>
>>Is this the appropriate way to test if the code field is something other
>>an a value? I find I can also say if myodbcreader("code").trim =
>>nothing.
>>>
>>What about or vs orelse? I've heard I should use orelse yet I don't
>>know why.
| >>
>Orelse means that if the first condition is true, then don't bother to
>check the next condition.
>>
>Best way to check to see if a column in an ODBCDataReader is null is
>to use the IsDBNull method.
| |