Chad
Chad

Reputation: 24679

System.Data.SqlTypes or NULLABLE native types?

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.

Upvotes: 1

Views: 114

Answers (1)

Pieter van Ginkel
Pieter van Ginkel

Reputation: 29632

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.

Upvotes: 1

Related Questions