pass data directly from the database..
for example we have table database{people} with records : ID , NAME ,AGE and table{gender} with : male , female.
and we have 3 textboxes in our form textBox1 that will be our ID , textBox2 and textBox3
and we have a comboBox that will have 2 items : male,female
oleDbConnection1.Open();
string query = "select * from gender";
OleDbCommand cmd = new OleDbCommand(query, oleDbConnection1);
OleDbDataReader rd = cmd.ExecuteReader();
while (rd.Read())
{
comboBox1.Items.Add(rd.GetValue(1).ToString());
}
rd.Close();
oleDbConnection1.Close();
and for the textboxes... :
oleDbConnection1.Open();
string query = "select * from people";
OleDbCommand cmd = new OleDbCommand(query, oleDbConnection1);
OleDbDataReader rd = cmd.ExecuteReader();
rd.Read();
textBox1.text = rd.Getvalue(1).ToString();
textBox2.text = rd.Getvalue(2).ToString();
textBox3.text = rd.Getvalue(3).ToString();
lexo1.Close();
oleDbConnection1.Close();
so we are getting data directly from database to textboxes or to Combobox with OleDbDataReader();