Solved

Strongly typed dataset Null Values Causes Exception

Posted on 2008-10-07
7
882 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
  • 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 250 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 250 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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

758 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now