null or DbNull or what?

G

Glenn Thimmes

Hello,

I am trying to find the most efficient way to send record UPDATES from a
client to my webservice. I am already using GetChanged to only send the
records that have actually been modified, but I would like to further reduce
network traffic by not sending individual columns that were not modified.

My first attempt in doing this was to use SQL stored procs that have default
values that would be values that would never actually be used for these
fields. The update statement then evaluates each parameter to determine
whether it should really update each column. This works great on the SQL
Server side, and I've discovered that by leaving the Command Parameter value
as null (not DbNull), the default values would be invoked. The problem here
lies in determining if a value in my DataTable is DbNull because it was set
to null or if it is DbNull because it was not changed. It seems that I
cannot actually set fields in a datarow to be actual null (not DbNull).

Is there something I am missing here?

Moreover, is there something bigger that I am missing? Is there a better
solution for minimizing the amount of XML being sent from my client to my
webservice? I do realize that a possible solution would be to stop sending a
DataSet and just use my own XML specification that allowed for more
flexibility in minimizing packets being sent. But that solution seems to
negate a great deal of Microsoft technology that we hoped to be leveraging.

Thank you for any suggestions,

Glenn Thimmes
 
V

Val Mazur \(MVP\)

Hi Glenn,

When you serialize dataset into XML, then if column contains NULL, then XML
tag will be missing for this row and column. Missing tag means NULL. I
believe you could use same way to treat NULL values in a SP. Just send XML
into SP and use OpenXML to work with it. See next example how you could send
XML into SP and work with it inside

http://support.microsoft.com/default.aspx?scid=kb;en-us;555266
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top