Freelance Project Requests info@CodeDocu.de Software Development in C# WPF Asp.Net Core Vba Excel Word SQL-Server EF Linq, UWP Net
#

Error: Comparison row==System.DBNull  DBNull is a type, which is not valid in the given context

 

 

Fehler:

Severity

Code

Description

Error

CS0119

'DBNull' is a type, which is not valid in the given context

 

 

string sMonth01 = ProductDate.dtMonth.ToString("yyyy-MM-01");

if (row[sMonth01] == System.DBNull) {

  row[sMonth01] = ProductDate.dtMonth.ToString("yyyy-MM-dd");

 }

  else

  {

  row[sMonth01] = row[sMonth01] + ", " + ProductDate.dtMonth.ToString("yyyy-MM-dd");

  }

 

Ein Bild, das Text enthält.
Automatisch generierte Beschreibung

 

 

 

Solution:

row[sMonth01] is System.DBNull

 

 

string sMonth01 = ProductDate.dtMonth.ToString("yyyy-MM-01");

if (row[sMonth01] is System.DBNull) {

  row[sMonth01] = ProductDate.dtMonth.ToString("yyyy-MM-dd");

  }

  else

  {

  row[sMonth01] = row[sMonth01] + ", " + ProductDate.dtMonth.ToString("yyyy-MM-dd");

  }

Ein Bild, das Text enthält.
Automatisch generierte Beschreibung

 

Mobile

.

Contact for Jobs, Project Requests: raimund.popp@microsoft-programmierer.de