Click here to Skip to main content
15,891,431 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a stored procedure that will supply the needed records (child records from table B) for a datagridview control. This is done with an @EmployeeID parameter in the stored procedure. Is there a way to supply this parameter to the stored procedure when I view another record from Table A so the datagridview will show the correct (child) records from table B?
Posted
Comments
Vic Rauch 28-Nov-11 21:24pm    
Let me try to clarify what I'm after. My Table A records show only one at a time on a form. But the detail (child) records from table B will show in the datagridview. I need to take the EmployeeID (which I have no problem getting) and somehow pass that to the record source (a SQL Server stored procedure) so the data in the datagridview will be the correct detail (child) records for the one record currently showing on the master (parent) form.
Vic

1 solution

without knowing what your application looks like, you need to look at the click event of the datagridview.

within this event you can get the current row information by using the datagrdview.currentrow

MSDN: Datagridview.currentrow property[^]

This link will show you how to read the cells of the datagridview row.

MSDN: How to get or set the Current Cell in the Windows Forms DataGridView Control[^]
 
Share this answer
 
Comments
Vic Rauch 28-Nov-11 21:23pm    
This is repeated here in case it is missed on my original post.
Let me try to clarify what I'm after. My Table A records show only one at a time on a form. But the detail (child) records from table B will show in the datagridview. I need to take the EmployeeID (which I have no problem getting) and somehow pass that to the record source (a SQL Server stored procedure) so the data in the datagridview will be the correct detail (child) records for the one record currently showing on the master (parent) form.
Vic

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900