I would suggest you to run a count, if your
emp_id
is integer. So, you will fetch the record only for one
employee
.
Your query would look something like...
string str = "select emp_name from Emp_table WHERE emp_id = @emp_id";
cmd = new SqlCommand(str, con);
cmd.Parameters.Add("@emp_id", empIdCount);
Define
empIdCount = 1
initially and then inside button click increament it to
1
. So, you will get the next
Id
. Thus, when you run the query, you will retrieve only one record and then just take the
emp_name
and assign it to the Label. So, Label will show new
emp_name
every time when you click the Button.