hii,can anyone tell what is wrong with this code.??
SqlCommand command = new SqlCommand("SELECT DISTINCT TOR_Name FROM TESTCASESTATUS_TABLE WHERE TestCaseID = '"
+ DropDownList1.SelectedItem.Text + "'", connection);
SqlDataReader x = command.ExecuteReader();
if (null != x && x.HasRows)
TestCaseName.Text = Convert.ToString(x["TOR_Name"]);
else
TestCaseName.Text = "something";
x.Close();
when i debug the code it is even getting into the if conditioon but then it is throwing an error, invalid attempt to read data when no data is present. !!! please help/.