C# ADO.NET: nulls and DbNull — is there more efficient syntax?

后端 未结 6 2079
时光取名叫无心
时光取名叫无心 2020-12-14 00:03

I\'ve got a DateTime? that I\'m trying to insert into a field using a DbParameter. I\'m creating the parameter like so:

DbParameter         


        
6条回答
  •  北荒
    北荒 (楼主)
    2020-12-14 00:45

    The way that I do it, is I have a static utility class that just goes through and checks to see if the parameter value is null, then i set the value to do DBNull. I just do that before i call the Execute.

提交回复
热议问题