I have a DataGridView binded to this table:
[Users] ID Name -- ---- 11 Qwe 22 Asd
Grid is direclty binded to typed dataset table.
I have a second table like this:
[Records] ID UserID Data -- ------ ---- 67 11 .... 68 11 ....
Records.UserID is connected to Users with a foreign key.
What I want to do is: when the user doubleclicks User #11 I open a new grid, binded to [Records] table but only binded to rows where UserID = 11. Doubleclick, getting ID, new grid etc. those are OK. I wouldn’t had any problems if I was doing this connected with sprocs but I want it to be binded and I simply have no idea how to do this.
Can you please give me any ideas?
In the end I had to this:
Create a DB class, with a public property (MyDataSetProperty) that returns the typedDataset
Create a custom Fill function in DataSet that accepts an Id parameter.
Use this function to fill the table in the private typedDataset
this.myTableAdapter.FillCustom(this.myTypedDataset.MyTable, this.Id);
Bind bindingSource to this public property:
this.bindingSource.DataSource = this.db.MyDataSetProperty;