Retrieving 'Child' Rows

I have a database with a table (tblEmployees) that stores employees details. It is linked to a table called tblDocumentArchive that stores information about employee documents (ie contract, appraisals etc). The information stored are things like document title, create date etc. They are linked as a 1-many relationship by EmployeeNumber.

I have a .NET form that has an OleDbConnector, Adapters as necessary, and a Dataset (dsEmpDocs) that has both the above tables within it. I have created a datagrid (grdEmp) on my form that is populated with employee names at run time. (I use Me.adptEmployees.Fill(dsEmpDocs) to populate the list) All my other fields are populated with the employee details and as I moved through the list of employees, so the data changes in each field - as expected.

However, I have another datagrid (grdEmpDocs) that lists (or should anyway) each document that is 'attached' to the current employee, but when I move through my employees in grdEmp, my list of documents doesn't get refreshed (all the other data does)

How can I get my second grid to refresh with the first? I have been going around in circles trying everything programmatically with examples, or everything graphically with a few lines of code, and I think I have just confused myself as to where I am now.

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

when the user navigates you have to filter the rows for the second datatable and then bind it

        dsEmpDocs.Tables(0).DefaultView.RowFilter = "employeeid=" + selectedempid

That should solve your problem.

Have Fun!
Craig_MucklestonAuthor Commented:
Hi Pratap,

Thanks for the info. I'm a little stuck though (I'm new to .NET). I understand everything you say up to "employeeid=" + selectdempid.

Is this the same as saying
dsEmpList.Tables(0).DefaultView.RowFilter = "EmployeeNumber" Is _ Me.tboEmpNo.Text

What do I bind the DataGrid to then? (Sorry for sounding naive)
no something like this

dsEmpList.Tables(0).DefaultView.RowFilter = "EmployeeNumber="  + Me.tboEmpNo.Text

that if your employeenumber is an integer or a number..

dsEmpList.Tables(0).DefaultView.RowFilter = "EmployeeNumber='"  + Me.tboEmpNo.Text.Replace("'","''") + "'"

the above if the emp# is a text (has alphabets in it)

you dont have to bind it to the datagrid again. once its bound its good.. you are talking about a windows application right? and not there binding is slightly different

Have Fun!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Craig_MucklestonAuthor Commented:
Hi Pratap,

Thanks for all your help, it works a treat.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.