I have a problem when I add record to database.Ii is an Access database.When I call Update method of daAlbums it throws an ecxception.Problem is that i dont know an ArtistID when I add new Artist to Artist Table.
DataRowView drvArtist = vueArtists.AddNew();
DataSet1.ArtistsRow rowArtist = (DataSet1.ArtistsRow) drvArtist.Row;
rowArtist.ArtistName = "asdasd";
drvArtist.EndEdit();
DataRowView drvAlbum = vueAlbums.AddNew();
DataSet1.AlbumsRow rowAlbum = (DataSet1.AlbumsRow) drvAlbum.Row;
rowAlbum.ArtistID = rowArtist.ArtistID;
rowAlbum.AlbumName = "qwerqw";
drvAlbum.EndEdit();
daArtists.Update(dsMp3.Artists);
daAlbums.Update(dsMp3.Albums);
DataRowView drvArtist = vueArtists.AddNew();
DataSet1.ArtistsRow rowArtist = (DataSet1.ArtistsRow) drvArtist.Row;
rowArtist.ArtistName = "asdasd";
drvArtist.EndEdit();
DataRowView drvAlbum = vueAlbums.AddNew();
DataSet1.AlbumsRow rowAlbum = (DataSet1.AlbumsRow) drvAlbum.Row;
rowAlbum.ArtistID = rowArtist.ArtistID;
rowAlbum.AlbumName = "qwerqw";
drvAlbum.EndEdit();
daArtists.Update(dsMp3.Artists);
daAlbums.Update(dsMp3.Albums);