?
Solved

Strongly typed dataset Null Values Causes Exception

Posted on 2008-10-07
7
Medium Priority
?
912 Views
Last Modified: 2013-11-26
I got a table that has columns that are int type that allow for nulls.  I used VS2005 dataset designer to create strongly typed dataset.  When I retrieve rows that have null values in those columns an exception is thrown.

Has anybody got a workaround to this.  I was thinking of changing type to string since in VS that is the only type I can set it not to throw exception then in my BLL convert it to nullable(of Integer).

Any ideas would certainly help.

Thank you

Rick
0
Comment
Question by:boricua1213
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
7 Comments
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 22663334
Have you tried typing the columns as Nullables?
0
 
LVL 2

Author Comment

by:boricua1213
ID: 22663396
Well,

in the properties of the column in the dataset AllowDBNull is set to True.

And in SQL the column is nullable.

What exactly do u mean by "typing the columns as Nullables"?

Rick
0
 
LVL 23

Accepted Solution

by:
Jens Fiederer earned 1000 total points
ID: 22663522
I was thinking of an approach like in
http://blogs.msdn.com/erickt/archive/2008/05/15/datasets-and-nullable-types.aspx
but that is VS2008, sorry.
0
 
LVL 23

Expert Comment

by:Jens Fiederer
ID: 22663667
With 2005, you just have to keep using IsNull before referencing the column.
0
 
LVL 96

Assisted Solution

by:Bob Learned
Bob Learned earned 1000 total points
ID: 22664029
With 2005, I would agree that you could use a String type, and set NullValue = (Empty) in the DataSet designer, and then cast it to a Nullable(Of Integer) in the BLL.


DataSet-Designer-NullValue.png
0

Featured Post

Technology Partners: 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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
Suggested Courses

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question