Quote:
SqlCommand command = new SqlCommand("SELECT * FROM tbl1 WHERE id=@id", conn);
You have got your answer, but I would like to mention one point here.
You have written
SELECT
*, which will select all Columns of the Table and is very time consuming.
But from the code, it is clear that you only need the Column "
name
" as you have written like
reader["name"]
.
So, you should change the Query to...
SqlCommand command = new SqlCommand("SELECT name FROM tbl1 WHERE id=@id", conn);