Team -

Could someone please tell me I haven't lost my mind? I have done relationships in the past but now they don't seem to work. Have I gone dumb?

Creating a winform, using VS2008, sqlexpress & vb.net. My dataset looks like this:
--------------------------------------------
Table 1 - BranchInformation
BranchID - int - identity - PK
Name
Address
YadaYada

Table 2 - Contact Information
ContactID - int - identity - PK
BranchID - int (related to BranchInformation.BranchID)
Phone
Fax
Favorite Hot dog topping.
---------------------------------------------

Fairly basic right?!? Here is the weirdness.

When using both with a detail view layout the child information (ContactID & BranchID) won't fill in like normal. Normal to me is the -1 for the identity field ContactID and the BranchID field should pull from the parent table. But they don't.

I have tried it now several times with no luck. What is stranger is if I use the detail view for Table 1 (Branch Information) and the gridview for Table 2, it works exactly as it should.

Can someone tell me what I am missing? It must be something simple. I have checked all the dataset configs and all of them are set to all inserts/update/delete and are also set to refresh data etc. What am I overlooking?

Thank you so much for your help or a point in the right direction!

Dewayne

>identity field ContactID and the BranchID field should pull from the parent table. But they don't.

Can you maybe provide some more information (code)about what it is you are trying to do?

Adatapost -

Thanks for working with me on this. I am not at the office right now so I can't do to much about this.

No real code to post, it has all been done by the gui. I will post a screen shot tomorrow, would that help?

I am really starting to think my VS2008 install has gone bad? I promise I have done this before! : )

Thanks again!
Dewayne

Ok, I think I know what may be going on. I am posting two screen shots, both using the same dataset and relationship. The detailView is the one that won't pull the identifiers from the parent. The datagridview is just to make sure the parent is pulling correctly.

I went through the threads you sent (thank you btw) but nothing seemed to really fit.

I think the issue is that in the detailsview (which is what I need) it isn't thinking it is adding a new record. The datagridview pulls it when the new row is started so it knows it's new.

There is no code behind the page, this is all pure gui. Thanks for your help.

You know, the more I look at this the more I question my initial design idea. What am I really gaining by having the contact information in a seperate table if I can only have one main contact per branch?

Do you think my origional idea is flawed?

Dewayne

Ok, so I changed my approach. My logic was flawed. I put all the unique data into the same table. There was really no gain in breaking it out.

I got a little to eager to granulate everything, oh well.

Thank you for your help & your time!

Dewayne

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.