add records to relational database

Dreamer

New member
Joined
Mar 8, 2003
Messages
3
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);
 
Whats the error that youre getting? Is it related to the ArtistID you mentioned? Also, did you design the Database or someone else?

-Nerseus
 
Back
Top