Return an array with null values

D

dwischnewski

I have the following code (excerpt):
<code> public struct UserAddress
{
public int ID;
public string companyName;
public string address;
public string city;
public string zip;
}
...
[WebMethod]
public List<UserAddress> GetAddresses(int UserID)
{
DbCommand cmd;
DbParameter param;
DbDataReader reader;
int Idx;
...
}</code>
If I have no data, for example for the field "companyName", I want to
return a NULL value (probably by omitting the value node from the
response xml). However, all my attempts to get there, always simply
return an empty node, e.g.: <companyName />.

Is there any way to accomplish this, we need to be able to differ
between empty strings and null values in the database.

Thanks,
Daniel
 
S

sakura

Never mind, somehow Visual Studio did not run the correct project and
all changes to the source did not affect the outcome at all. As to why
this is, I got no idea.

Simply setting the value to NULL achieves the desired result.

Thanks,
Daniel
 

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

Members online

Forum statistics

Threads
473,770
Messages
2,569,584
Members
45,075
Latest member
MakersCBDBloodSupport

Latest Threads

Top