hi im making a code wherein all the database values from different tables appear in one form provided below:
NpgsqlConnection conn = new NpgsqlConnection(connstring);
NpgsqlCommand cmd = new NpgsqlCommand("SELECT * FROM identification; SELECT * FROM height; SELECT * FROM weight; SELECT * FROM bloodpressure WHERE eid like '" + textBox1.Text + "%'", conn);
conn.Open();
using (NpgsqlDataReader dr = cmd.ExecuteReader())
{
while (dr.Read())
{
textBox3.Text = (dr["lastname"].ToString());
textBox4.Text = (dr["firstname"].ToString());
textBox2.Text = (dr["middlename"].ToString());
textBox9.Text = (dr["sex"].ToString());
textBox5.Text = (dr["birthdate"].ToString());
textBox6.Text = (dr["age"].ToString());
textBox10.Text = (dr["department"].ToString());
textBox7.Text = (dr["address"].ToString());
textBox11.Text = (dr["status"].ToString());
textBox8.Text = (dr["contact"].ToString());
}
if (dr.NextResult())
{
while (dr.Read())
{
textBox12.Text = (dr["height"].ToString());
}
}
if (dr.NextResult())
{
while (dr.Read())
{
textBox15.Text = (dr["weight"].ToString());
}
}
if (dr.NextResult())
{
while (dr.Read())
{
textBox16.Text = (dr["systole"].ToString());
textBox17.Text = (dr["diastole"].ToString());
}
}
the code runs however only the values on the former eid appears whenever i tried to type another eid. what should i do so that all the values of a selected eid appears on the form?


textBox1.Text?textBox1.Text + "weight") for debugging and still see the same effect. Please simplify code in the post and add missing pieces (this will also avoid embracing SQL injection code from being ridiculed).