I am wanting to know how i can check if a field contains null value and replace it with text N/A or just not display the field. But i don't want the code to break if the field contains null i want it to continue until all fields are filled with a value.
C# Code
using (var connection = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString))
using (var command = connection.CreateCommand())
{
command.CommandText = "SELECT FirstName, LastName, Date FROM EOI WHERE (FormID = '13')";
connection.Open();
using (var reader = command.ExecuteReader())
{
while(reader.Read())
{
Label1.Text = reader["FirstName"].ToString();
Label2.Text = reader["LastName"].ToString();
DateTime Text = Convert.ToDateTime(reader["Date"]);
Label3.Text = Text.ToString("d");
}
}
}