There is a similar question that is unanswered on stackoverflow, but I believe I am very close to solving it. But basically, my sql statement returns more than one value, but only a single value is displayed in the label whereas it should be 4 or 5 values.
protected void btnPopulate_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection(strings.settings.connectionString);
SqlCommand command = new SqlCommand("SELECT ID FROM dbo.MDRMASTER WHERE MASTERPID = @MASTERPID",con);
command.Parameters.Add("@MASTERPID", SqlDbType.NVarChar).Value = txtMASTERID.Text;
con.Open();
SqlDataReader dr = command.ExecuteReader();
while (dr.Read())
{
string ID = dr["ID"].ToString();
lblIDs.Text = ID;
}
con.Close();
}
any help would be greatly appreciated. Thanks!