Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 318
  • Last Modified:

Get exception in my dataset when reading a xml-schema with empty fields

Hi,

I call a web service, the result is a xml (dataset).

The xml contains empty fields and I want my dataset to replace the empty fields with default values. This doesn't work and when I try to reach the fields I get a exception. The field has no value.

I want the dataset to set defaultvalues for empty fields.
0
TYB
Asked:
TYB
  • 3
  • 2
1 Solution
 
MuntiCommented:
what is the exception?
0
 
TYBAuthor Commented:
An unhandled exception of type 'System.Data.StrongTypingException
0
 
MuntiCommented:
How do you work with the data? Do you load it into a dataset? If then there really should be no problem in looping through the datatables rows and check for null value in each column.

foreach(DataRow row in ds.Tables["tablename"/index].Rows)
{
for(int i=0;i<row.items.length;i++)
{
if(row[i].ToString() == "")
row[i] = "put your value here...";
}
}
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
TYBAuthor Commented:
The web service return the dataset as return value.

MyWebservice myService = new MyWebservice();

DataSet dSet = new DataSet();

dSet = myWebService().GetAll();
0
 
MuntiCommented:
The above code should work fine for that then.
0
 
sun4sundayCommented:

The exception that is thrown by a strongly-typed DataSet when the user accesses DBNull value.

ie.  IF the dataset  returning the DBnull value this exception will throw.

http://www.dotnet247.com/247reference/a.aspx?u=http://www.kbalertz.com/Feedback_318039.aspx

plz give more details...

sun4sunday
0

Featured Post

Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now