Obtaining data from Web Service

  • Thread starter Thread starter Roshawn
  • Start date Start date
R

Roshawn

Hi,

OK, guys and gals. This one has been troubling me for some time now, and
I've yet to come up with a viable solution. Here goes.

I am consuming a web service that returns product information for books
(title, publisher, price, etc). I'm using ADO.NET on the client side to
save this data to a local MSDE 2K database. This is simple enough, assuming
that a connection to the web service is available.

Now the problem. I keep the data in the database for only 24 hours max.
This is because some fields in the database table (particularly price and
availability) change. Changes to data isn't done on the client at any time
but are retrieved from the web service. When the data is retrieved, it is
placed in a DataSet object. Keep in mind that the DataRowState of each row
in the DataSet is Unchanged. However, some rows are likely to contain new
values that are different from those stored in local database.

All I want to do is place the new values in the database where appropriate
without having to overwrite other data (about books) that remains constant.

Can anyone help me? I have only a few strands of hair left and would like
to keep them :-( !!!

Thanks,
Roshawn
 
Thanks for your reply, novelle. I'm sorry that I didn't make things
clearer. The web service that I'm consuming is not one created using the
..NET Framework. It is created using a non-Microsoft language and returns an
array of data, not a DataSet.

Keep in mind that there are no data modification what so ever on the client
(no inserts, updates, or deletes). So performing a DataSet.Merge is not
viable.

I'm still thinking about this. Hopefully, you or I will come up with a
solution.

By the way, the web service that I'm consuming is the Amazon Web Service
(AWS).

Roshawn
 
Roshawn said:
Thanks for your reply, novelle. I'm sorry that I didn't make things
clearer. The web service that I'm consuming is not one created using the
.NET Framework. It is created using a non-Microsoft language and returns
an array of data, not a DataSet.

Keep in mind that there are no data modification what so ever on the
client
(no inserts, updates, or deletes). So performing a DataSet.Merge is not
viable.

I'm still thinking about this. Hopefully, you or I will come up with a
solution.

By the way, the web service that I'm consuming is the Amazon Web Service
(AWS).

Roshawn

Ok, maybe this is easy.

So you get an array of data that is the 'refresh' and you have an existing
database with some other information that you have added.

You don't want to overwrite the database each time you refresh.

So, loop through the array that you get from amazon. I assume there is a
key value or id.

So, for each row in the array, do a look up in your local database.

If the id does not exist in the database, do a sql INSERT.

If the id does exist, do a sql UPDATE and only change the fields that you
want to change ( the ones from amazon ) and not the fields that you added.
 
"...only change the fields that you want to change ( the ones from amazon )
and not the fields that you >added."

I understand this concept. There are only a few fields that would change.
But why would I need to overwrite something that may not have changed.
There must be a way to compare the the values that I get from Amazon with
the ones I have in my database. If the values are the same then they need
not be overwritten in the database; otherwise, they should be overwritten.

Doing it this way would ensure that only fields that need to be changed are
changed and that other fields are not needlessly overwritten. And this
would not hamper performance.

Roshawn
 
Back
Top