I did exactly like you said and got an error -- Command "dr
(3)" is not valid. Here is what ended up working:
If CType(dr(dc.Ordinal), String) = Chr(0) Then
I cannot say I know why -- maybe a ASCII vs. Unicode
problem? I am going to try the statement:
if dr(dc.Ordinal) = chr(0) then
just to remove the casting call if possible but I wanted
you to see this for your future reference. I have no idea
why I was unable to see this value -- if you have any
insight I would appreciate it.
Thanks so much for all your suggestions! If I can help
you in any way -- just remove the extra m from the email
on one of my earlier posts.
Thanks again!
Mike
>-----Original Message-----
>Why don't you simply set a breakpoint at that line and
then in the Command
>window enter:
>dr(3) <enter>
>
>That shoud tell you precisely what is in that field
>
>"mikemc" <(E-Mail Removed)> wrote in
message
>news:100801c3ae4b$9c818520$(E-Mail Removed)...
>> That made a difference meaning that now the code and
watch
>> window evaluate the same but the line:
>>
>> If Convert.IsDBNull(dr(3)) = True Then
>>
>> evaluates to false. That means that something exists
but
>> I can't determine what. Please let me know if you think
>> of anything else -- and I will get back to you if I find
>> anything. Next steps are to compare against chr(0) and
>> maybe to start sniffing glue!
>>
>>
>> >-----Original Message-----
>> >How about Convert.IsDBNull(dr(3))?
>> >
>> >"mikemc" <(E-Mail Removed)> wrote in message
>> >news:0c7e01c3ae1a$cc7358c0$(E-Mail Removed)...
>> >> Here is what I changed to Alex (I hardcoded the
problem
>> >> column reference and changed my webservice to only
>> return
>> >> the problem record):
>> >>
>> >> If dr(3) Is DBNull.Value Then
>> >>
>> >> which evaluates to False when I step through -- but
the
>> >> watch window evaluates this to True.
>> >>
>> >> Any thoughts?
>> >>
>> >>
>> >> >-----Original Message-----
>> >> >Compare to DBNull.Value instead
>> >> >
>> >> >"mikemc" <(E-Mail Removed)> wrote in message
>> >> >news:0d3b01c3ade2$91edf0d0$(E-Mail Removed)...
>> >> >> I am trying to consume a untyped dataset from a
>> VB.NET
>> >> >> webservice and update a local SQL Server CE 2.0
db.
>> >> When
>> >> >> one of the values is null, I have been unable to
>> >> >> successfully test for it to build a SQL stmt.
>> >> >>
>> >> >> I have tried: 1) If dr.IsNull(dc.Ordinal) Then,
2) If
>> >> >> dr.Item(dc.Ordinal).ToString.Trim.Length = 0
Then, 3)
>> >> If dr
>> >> >> (dc.Ordinal).ToString = "", and 4) If dr
>> >> >> (dc.Ordinal).ToString = [String].Empty where dr is
>> the
>> >> >> datarow and dc is the datacolumn.
>> >> >>
>> >> >> Every one of these statements (conditionals)
appears
>> to
>> >> >> work fine in the Watch window and there are no
>> >> exceptions
>> >> >> thrown.
>> >> >>
>> >> >> Can anybody help me please?
>> >> >>
>> >> >> Thanks. Mike
>> >> >
>> >> >
>> >> >.
>> >> >
>> >
>> >
>> >.
>> >
>
>
>.
>
|