BindingManagerBase

J

Joe

can someone help me with this code

(1) daNewEmployer.Fill(DsNewEmployer)
(2) daNewEmployee.Fill(DsNewEmployer)
(3)bmbEmployer = BindingContext(DsNewEmployer, "Employer")

I am trying to fill a the bindingmanagerbase with two
tables in the third line of code. However, it only takes
two arguments, the dataset "DsNewEmployer" and the
table "Employer". I need to add the "Employee" table to
the same data set i.e. "DsNewEmployer". Can some one help
me.Thanks in advance
 
C

CJ Taylor

You don't want to do this through your binding manager. Instead, I would
define the relationships in your dataset, or build a "composite" table to
display the info you want.
 
G

Guest

can you give me an example of either one? I am new to
database programming with ado.net and as such I have not
seen one done before.

Thanks Joe
 
C

CJ Taylor

Alright, in your dataset designer, First of all, set your keys, which I'm
sure you have done. you can do this by right clicking on the table.

Click on your child table, right click, choose new relationship, set your
parent and child tables (your child table will be your parent because of the
key) and associate the fields.

Save and readd this dataset to your windows form designer. When you go to
bind any control, there will be a new subsection in the datamember property
that shows your relationship name, click on it, and you have access to all
the related sub fields. The joins are taken care of by the database.

if you still have problems, email me your dataset and project, I'll set it
up for you and write a little HOWTO, on what I did. Sound cool?

-CJ
 
J

Joe

Hey Taylor,
I was referring to BindingContext and not the
BindingManagerbase. My apologies. The two tables were
the "Employer" table and the "Employee" table. The first
code I had was

bmbEmployer = Me.BindingContext(DsNewEmployer, "Employer")

I need the Employer and Employee table to refer to the
same dataset.

The "DsNewEmployer" the dataset, however it holds the
Employer and the Employee info. I know it is bad
programming practice to name the dataset this way but I
am going to change it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top