Cannot add record for child table that have relationship with master table.

G

Goh

Got a question examples the senario is like that.

if we got master and detail table.

detail table have a relationship with th master table with a primary key.

primary key is an auto number.

from my testing if master table show in "detail view" and detail table show
in "datagrid view" the add function for detail table work corrently because
of datagrid will automatic add primary key relation to the master table
primary key.

The problem come when detail table is shown in the form of "detail view"
there is no auto add primary key to detail table future. error will be raise
up, saying that primary key must be enter before add to the table.

But I can't know what is the current primary key for the master table.

And because of the master table have not update to database I also can't get
any the real primary key for the child table.

As result I can't add record for the detail table if I use "detail view"
layout How to solve this?


Please give me some advice about this.

Thanks in advance

Goh
 
K

Kevin Yu [MSFT]

Hi Goh,

Did you drag all the controls from the DataSource toolbox? If you need
handle the autoincrement in DataSet, you can directly set the AutoIncrement
= true, AutoIncrementSeed =-1 and AutoIncrementStep = -1 property to make
the DataSet handle auto number itself.

Kevin Yu
Microsoft Online Community Support

============================================================================
==========================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
============================================================================
==========================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

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