سلام ،
بهتره از Count و Where استفاده کنی به مثال زیر دقت کن :
SqlCommand cmd = new SqlCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "Select count(*) from table1 where dars=@param";
cmd.Parameters.AddWithValue("@param", textBox1.Text.Trim());
int a = 0;
a = Convert.ToInt32(cmd.ExecuteScalar());
if (a > 0)
{
MessageBox.Show("این درس قبلا توسط استاد گرفته شده");
}
else
{
//Do somrthing
}
موفق باشید./