I'm using the mySql connector with phpMyadmin and i try to verify if a value is a DBNull cause it make my project bug and I didn't succeed to find a way to verify it.
I tried:if( aReader.GetString("ColumnName") != DBNull.value){...}
but it doesn't work.
I have this error:
System.InvalidCastException: 'Unable to cast object of type 'System.DBNull' to type 'System.String'.'
the code i made is :
MySqlDataReader aReader = aMySqlCommand.Command.ExecuteReader();
while(aReader.Read())
{
aReader.GetString("columnName"); // there's the place where I get my error
}
thanks for you answer