G
GFSIan
Guest
I cannot work out why child record will not save foreign key.
Visual Studio 2010 Visual Basic
I have 2 tables in table 1 primary key is ID and in table 2 foreign key is ID
I have then created a dataset and from Solution Explorer and added Relation Only (Key Columns ID and Foreign Key Columns ID)
Then dragged a DataGridView from the dataset to my form for the Parent table and then dragged a DataGridView for the 2nd table (selecting the table from within the first table list through the DataSources window)
When I add the first record to the parent table, the 2nd DataGridView correctly entered the foreign key at -1
and if I add a 2nd record to parent, enters -2 and so on
but when I save, it is saved as -1 (-2...) rather than change to the actual primary key ?
I cannot understand what I have missed ?
Continue reading...
Visual Studio 2010 Visual Basic
I have 2 tables in table 1 primary key is ID and in table 2 foreign key is ID
I have then created a dataset and from Solution Explorer and added Relation Only (Key Columns ID and Foreign Key Columns ID)
Then dragged a DataGridView from the dataset to my form for the Parent table and then dragged a DataGridView for the 2nd table (selecting the table from within the first table list through the DataSources window)
When I add the first record to the parent table, the 2nd DataGridView correctly entered the foreign key at -1
and if I add a 2nd record to parent, enters -2 and so on
but when I save, it is saved as -1 (-2...) rather than change to the actual primary key ?
I cannot understand what I have missed ?
Continue reading...