1

If you are using a SQL Server database and you want to store null and non null values read from the database, which .NET data types are best suited, NULLABLE native types or SQLTypes?

I don't care about db portability to a different db.

Chad
  • 23,658
  • 51
  • 191
  • 321

1 Answers1

1

This 100% depends on what you're going to do with it. If you're interacting with SqlCommands and associates, you for example have to use DbNull. However, my experience is that its usefulness stops there. With the rest of .NET, you're better off with native types. WPF for instance now supports Nullable<bool> for CheckBox.IsChecked which binds very well to native types, but not as nicely to the SQL types.

Pieter van Ginkel
  • 29,160
  • 8
  • 71
  • 111