Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Strongly typed dataset Null Values Causes Exception

Posted on 2008-10-07
7
Medium Priority
?
916 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

Industry Leaders: 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

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Visualize your data even better in Access queries. Given a date and a value, this lesson shows how to compare that value with the previous value, calculate the difference, and display a circle if the value is the same, an up triangle if it increased…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…

610 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