Solved

Strongly typed dataset Null Values Causes Exception

Posted on 2008-10-07
7
893 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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Code works but it's slow 28 70
EF5: Question about Metadata Artifact Processing 4 15
Regular expression help 2 25
VB.Net Tranfer data between to VB.Net apps 8 26
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…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.

809 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