codedocu.de

Fehler:  Vergleich 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");

  }

 

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

 

 

 

Lösung:

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");

  }

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

 


Software Entwicklung Stuttgart Nürtingen
Suche Projekte C#, WPF, Windows App,ASP.Net, vb.Net, WinForms, SQL Server, Access, Excel