// // Class: Util // Current CLR: 4.0.30319.34209 // System: Microsoft Visual Studio 10.0 // Author: dani // Created: 3/21/2015 10:36:56 AM // // Copyright (c) 2015 Informatikbüro Daniel Schick. All rights reserved. using System; using System.Data.SqlClient; using System.Collections.Generic; namespace bsmd.database { public static class Util { /// /// Extension helper to add values that can be null: /// http://stackoverflow.com/questions/13451085/exception-when-addwithvalue-parameter-is-null /// public static SqlParameter AddWithNullableValue(this SqlParameterCollection collection, string parameterName, object value) { if (value == null) return collection.AddWithValue(parameterName, DBNull.Value); else return collection.AddWithValue(parameterName, value); } } }