Hello I have tried to handle Null exception but I'm still receiving the exception warning: data is null this method or property cannot be called on null values.
This is my code:
spojeni.Open();
string sql_combobox = "SELECT column FROM tableO RDER BY nazev ASC";
SqlCommand combobox = new SqlCommand(sql_combobox, spojeni);
try
{
SqlDataReader dr = combobox.ExecuteReader();
while (dr.Read())
{
if (!dr.IsDBNull(0))
{
comboBox1.Items.Add(dr["column"]);
}
}
dr.Close();
dr.Dispose();
spojeni.Close();
}