When I execute my code below, this error message occurs:
"An exception of type \'System.Data.SqlClient.SqlException\' occurred in System.Data.dll bu
I think your EmpID column is string and you forget to use ' ' in your value.
Because when you write EmpID=" + id.Text, your command looks like EmpID = 12345 instead of EmpID = '12345'
Change your SqlCommand to
SqlCommand cmd = new SqlCommand("SELECT EmpName FROM Employee WHERE EmpID='" + id.Text +"'", con);
Or as a better way you can (and should) always use parameterized queries. This kind of string concatenations are open for SQL Injection attacks.
SqlCommand cmd = new SqlCommand("SELECT EmpName FROM Employee WHERE EmpID = @id", con);
cmd.Parameters.AddWithValue("@id", id.Text);
I think your EmpID column keeps your employee id's, so it's type should some numerical type instead of character.