Click here to Skip to main content
15,908,437 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: about ObjectDisposedException Pin
Guffa25-Jun-06 0:39
Guffa25-Jun-06 0:39 
Questionhelp needed in pushing object eg. a vcard from my desktop to a bluetooth device Pin
piyushnarain24-Jun-06 2:34
piyushnarain24-Jun-06 2:34 
QuestionWinSocket Library in C#? Pin
Andy Rama23-Jun-06 23:13
Andy Rama23-Jun-06 23:13 
AnswerRe: WinSocket Library in C#? Pin
Jun Du24-Jun-06 2:53
Jun Du24-Jun-06 2:53 
GeneralRe: WinSocket Library in C#? Pin
Andy Rama25-Jun-06 19:51
Andy Rama25-Jun-06 19:51 
GeneralRe: WinSocket Library in C#? Pin
Jun Du26-Jun-06 3:07
Jun Du26-Jun-06 3:07 
GeneralRe: WinSocket Library in C#? Pin
Andy Rama26-Jun-06 23:37
Andy Rama26-Jun-06 23:37 
QuestionWorking with null database values - Object vs SqlTypes vs Nullable(Of T) Pin
Anthony Ford23-Jun-06 7:04
Anthony Ford23-Jun-06 7:04 
The following question can, of course, apply to other types (Boolean, DateTime, Double, etc), but for the puruposes of my question, let's just talk about the Integer type.

In my programming travels, the situation frequently arises where I have a nullable integer field in a database that I need to be able to work with in my code. As you know, there is no equivalent null value for the Integer type in .Net, so as far as I can tell my options are to use one of the following types instead of Integer:

Object
SqlInt32
Nullable(Of Integer)

As I see it, each comes with drawbacks:

Object - isn't strongly typed and (I assume) is less efficient.

SqlInt32 - I have to use SqlDataReader.GetSqlInt32(), which requires specifying the column index, not the name. I don't like this because it makes maintenance just a little harder by having to keep up with column orders.

Nullable(Of Integer) - When a null value is encountered, an InvalidCastException occurs because there is no way to cast a System.DBNull to a Nullable(Of Integer). My only way around this is to test the column with IsDbNull(), before attempting to assign the value. It just really seems wrong to have to do this extra step to get a null to equal a null. One friend made a suggestion to write a helper class to keep the IsDbNull() tests hidden away, but this only helps to keep the code cleaner.

Does anybody have any good suggestions or ideas or resources to point me towards? Thanks for your time and help.


Anthony
AnswerRe: Working with null database values - Object vs SqlTypes vs Nullable(Of T) Pin
Guffa23-Jun-06 11:59
Guffa23-Jun-06 11:59 
QuestionOn TreeviewControl.nodes.remove(node) other nodes are disapearing Pin
Desert Star23-Jun-06 6:35
Desert Star23-Jun-06 6:35 
QuestionMessageQueues, PocketPC 2003 and HTTP Transport... possible? Pin
displaced8023-Jun-06 1:37
displaced8023-Jun-06 1:37 
QuestionSo how do I specify debug only in .NET/C# Pin
nicknotyet22-Jun-06 10:23
nicknotyet22-Jun-06 10:23 
AnswerRe: So how do I specify debug only in .NET/C# Pin
Dustin Metzgar22-Jun-06 10:35
Dustin Metzgar22-Jun-06 10:35 
GeneralRe: So how do I specify debug only in .NET/C# Pin
nicknotyet22-Jun-06 11:21
nicknotyet22-Jun-06 11:21 
AnswerRe: So how do I specify debug only in .NET/C# Pin
Guffa22-Jun-06 10:42
Guffa22-Jun-06 10:42 
AnswerRe: So how do I specify debug only in .NET/C# Pin
Josh Smith23-Jun-06 3:55
Josh Smith23-Jun-06 3:55 
GeneralRe: So how do I specify debug only in .NET/C# Pin
Dustin Metzgar23-Jun-06 4:02
Dustin Metzgar23-Jun-06 4:02 
GeneralRe: So how do I specify debug only in .NET/C# Pin
Josh Smith23-Jun-06 4:08
Josh Smith23-Jun-06 4:08 
Questionhow to write the volume Pin
wanda197222-Jun-06 9:11
wanda197222-Jun-06 9:11 
GeneralRe: how to write the volume Pin
Guffa22-Jun-06 10:50
Guffa22-Jun-06 10:50 
QuestionTargetInvocationException Pin
kreaThor22-Jun-06 8:02
kreaThor22-Jun-06 8:02 
AnswerRe: TargetInvocationException Pin
kreaThor22-Jun-06 9:08
kreaThor22-Jun-06 9:08 
GeneralRe: TargetInvocationException Pin
Josh Smith23-Jun-06 8:22
Josh Smith23-Jun-06 8:22 
Questionhow to create popup menu in IE Pin
LakshmiPathiRao22-Jun-06 2:04
LakshmiPathiRao22-Jun-06 2:04 
AnswerRe: how to create popup menu in IE Pin
Aurelius166427-Jun-06 11:10
Aurelius166427-Jun-06 11:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.