@zachary marcotte , you could try the following code to show the label text from sql serer table.
private void button1_Click(object sender, EventArgs e)
{
string connstr = @"connstr";
SqlConnection connection=new SqlConnection(connstr);
string sql = string.Format("select Score from Hockey where Name='{0}'",textBox1.Text);
connection.Open();
SqlCommand cmd = new SqlCommand(sql, connection);
SqlDataReader reader = cmd.ExecuteReader();
while(reader.Read())
{
label1.Text = reader["Score"].ToString();
}
}
Database:
Result in the winform:
You can change your code appropriately according to my code.
Hope this could help you.
Best Regards,
Jack
If the answer is the right solution, please click "Accept Answer" and upvote it.If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.