private void Form2_Load(object sender, EventArgs e) { if (Id != null) { //bringing the result of the select, it only brings me the row with the sent id userDS.UsersDataTable usersDataTable = usersTableAdapter.GetDataById((int)Id); userDS.UsersRow userRow = (userDS.UsersRow)usersDataTable.Rows[0]; textBox1.Text = userRow.firstName; textBox2.Text = userRow.lastName; } }
public void RefreshInfo() { // 2_Create a DataTable object within the DataSet and tell it that it will be the same // that the selection method that we had defined in the creation of the TableAdapter userDS.UsersDataTable usersDataTable = usersTableAdapter.GetData(); // 3_Finally we define the DataSource of our dataGridView = to the DataTable that we obtained from // TableAdapter "usersDataTable" dataGridView1.DataSource = usersDataTable; Refresh(); }