Hi, I just started to use C# and I have a problem.
Code:
I tried a if else to teste the null, diferent casts but cant seem to find a workaround, can anyone help?
Thanks in advance,
Mad Cat
Code:
C#:
myConnection.Open();
myDataReader = myCommand.ExecuteReader();
while (myDataReader.Read())
{
Label1.Text = (string)Clientes.GetValue(0);
// Error below when there is a null value in the database
Label2.Text = (string)Clientes.GetValue(1);
}
I tried a if else to teste the null, diferent casts but cant seem to find a workaround, can anyone help?
Thanks in advance,
Mad Cat
Last edited by a moderator: