DataBind to specific records
-
I have a DataGridView binded to this table:
[Users]
ID Name
11 Qwe
22 AsdGrid is directly binded with a typed dataset. 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 doubleclicksUser #11
I open a new grid, binded to Records table but only binded to rows whereUserID = 11
. Doubleclick, getting ID, new grid etc. those are I'm OK with. 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? -
I have a DataGridView binded to this table:
[Users]
ID Name
11 Qwe
22 AsdGrid is directly binded with a typed dataset. 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 doubleclicksUser #11
I open a new grid, binded to Records table but only binded to rows whereUserID = 11
. Doubleclick, getting ID, new grid etc. those are I'm OK with. 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?I would use a dataview to service the records gridview. When the user double clicks you set the rowfiler of the dataview
Dataview1.RowFilter = String.format("UserID = {0}",UserIDValue)
changing the filter of the dataview automatically updates the records gridviewNever underestimate the power of human stupidity RAH
-
I would use a dataview to service the records gridview. When the user double clicks you set the rowfiler of the dataview
Dataview1.RowFilter = String.format("UserID = {0}",UserIDValue)
changing the filter of the dataview automatically updates the records gridviewNever underestimate the power of human stupidity RAH
-
Thanks for the reply. The problem with Filter is that you have to retrieve all of the records first, than display the ones according to filter. Is there a way to retrieve just the records you want in the first place?
kensai wrote:
Is there a way to retrieve just the records you want in the first place?
But of course. You have the userid, create a proc that returns the records for that user and bind the resulting datatable to the datasource. Changing datasource is a standard operation!
Never underestimate the power of human stupidity RAH
-
kensai wrote:
Is there a way to retrieve just the records you want in the first place?
But of course. You have the userid, create a proc that returns the records for that user and bind the resulting datatable to the datasource. Changing datasource is a standard operation!
Never underestimate the power of human stupidity RAH
-
Unfortunately, the database is Sql Server CE which doesn't support sprocs :sigh: I think I need a way to bind data to a tableadapter custom method which returns records according to a parameter, in this case ID. No idea how to do this though :-O
How do you get your data now, presumably SQL strings if procs are not supported. What's wrong with the following.
Select * from Records where UserID = iUserID
Never underestimate the power of human stupidity RAH