PC Review


Reply
Thread Tools Rate Thread

Consume Dataset from Webservice

 
 
mikemc
Guest
Posts: n/a
 
      18th Nov 2003
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
 
Reply With Quote
 
 
 
 
Alex Feinman [MVP]
Guest
Posts: n/a
 
      18th Nov 2003
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



 
Reply With Quote
 
mikemc
Guest
Posts: n/a
 
      18th Nov 2003
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

>
>
>.
>

 
Reply With Quote
 
Alex Feinman [MVP]
Guest
Posts: n/a
 
      18th Nov 2003
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

> >
> >
> >.
> >



 
Reply With Quote
 
mikemc
Guest
Posts: n/a
 
      19th Nov 2003
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
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
Alex Feinman [MVP]
Guest
Posts: n/a
 
      19th Nov 2003
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
> >> >
> >> >
> >> >.
> >> >

> >
> >
> >.
> >



 
Reply With Quote
 
Guest
Posts: n/a
 
      19th Nov 2003
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
>> >> >
>> >> >
>> >> >.
>> >> >
>> >
>> >
>> >.
>> >

>
>
>.
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Consume webservice via GPRS =?Utf-8?B?SGF5dGhhbQ==?= Microsoft Dot NET Compact Framework 0 2nd Aug 2006 12:31 AM
Call/Consume .net webservice from PHP Nattydreadlock Microsoft Dot NET 1 12th May 2006 03:59 PM
Ways to consume a WebService returning a large dataset Cybertof Microsoft C# .NET 1 14th Sep 2005 10:40 PM
Consume php webservice in asp.net Paul Hermans Microsoft ASP .NET 1 10th Jun 2004 06:40 PM
Getting Access to Consume a Webservice Mike Pearson Microsoft Access Getting Started 0 20th Jul 2003 07:55 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:50 PM.