sunny123456

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

C# 反射数据库数据过程中值类型存在DBNull的处理方法

  1. GeliRvTask task = new GeliRvTask();
  2. foreach (var item in task.GetType().GetProperties())
  3. {
  4. if (btn.EditorCell.GridRow.Cells[item.Name].Value != System.DBNull.Value)
  5. {
  6. item.SetValue(task, btn.EditorCell.GridRow.Cells[item.Name].Value, null);
  7. }
  8. }

 

https://blog.csdn.net/qq_35106907/article/details/88421612
posted on 2022-03-25 12:57  sunny123456  阅读(168)  评论(0编辑  收藏  举报