Three things:
You have a typo on this line
command.Parameters.Addwithvalue("@name", nametxt.Text);
The method is
AddWithValue
(note the case difference)The constructor of
SqlDataAdapter
takes the command but no connection then since the command already contains the connection, so this is correct:SqlDataAdapter sda = new SqlDataAdapter(command);
Probably the most important last:
If you use
LIKE
you need to use the wild-cards%
:command.Parameters.AddWithValue("@name", string.Format("%{0}%",nametxt.Text);