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

  • Thread starter Thread starter Goh
  • Start date Start date
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
 
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.)
 
Back
Top