if you searching and display single item from database you can do as below
using (var connection = new SqlConnection("connection string"))
{
connection.Open();
using (var cmd = new SqlCommand("SELECT name , brand , model , price FROM Product WHERE ProductID=@MYVALUE", connection))
{
cmd.Parameters.AddWithValue("@MYVALUE", txtID.Text);
SqlDataReader re = cmd.ExecuteReader();
if (re.Read())
{
txtName.Text = (string)re["name"];
txtBrand.Text = (string)re["brand"];
txtModel.Text = (string)re["model"];
txtPrice.Text = (string)re["price"];
}
else
{
MessageBox.Show("Please enter a valid product id");
}
}
}
based on user input, sql command will fetch the data and it will display the record details on UI labels.
if you need to show multiple records, you better use controls like DataGridView or ListView.