471,897 Members | 1,589 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,897 software developers and data experts.

XML reading database null value as an empty string ""

I am using the XMLTextWriter to build an XML string and pass it to the
XMLDocument. When I get the data from SQL Server, some of the values
passed to the XML are NULL in the database. When I try and run an
update to database using the same XML string, (using SQL parameters to
pass the selectsinglenode), the XML always shows the NULL values as an
empty string "". This is then updating the database with an empty
value rather than keeping the NULL (which if the XML passed single
quotes, I assume the NULL would be there).

I use the SqlDbType to set the datatype of each parameter I pass.
I've had to set up all paramerter value types with the ConvertTo.Int32
when I have an Int datatype... Do I need to convert my char and
varchar fields so I can get a NULL value rather than the empty string?

I'm very new to all this. If you need more information to help me
resolve this problem, please let me know.
Nov 16 '05 #1
0 2082

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

12 posts views Thread by aa | last post: by
2 posts views Thread by Denis Perelyubskiy | last post: by
13 posts views Thread by Don Vaillancourt | last post: by
5 posts views Thread by rengeek33 | last post: by
2 posts views Thread by Jeff | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.