Click here to Skip to main content
15,894,106 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
There are 2 Table:

MasterTable => Columns: ID, DetailTable_ID, Description
DetailTable => Columns: ID, Title

First I wanna add a row to DetailTable, then I wanna add a row to MasterTable that it will requires a new DetailTable row.ID which is -1.
I want to add them to DataSet not DataBase.

I'd tried this:

C#
long movieID = long.Parse(this.Movie.SelectedValue.ToString());

Data.VMS.DataSet.MovieGenreRow row = this.VMSDataSet.MovieGenre.NewMovieGenreRow();

row.Movie_ID = movieID;


Data.VMSDataSet.GenreRow genreRow = this.VMSDataSet.Genre.NewGenreRow();

genreRow.Title = this.GenreTitle.Text;
genreRow.Description = this.GenreDescription.Text;

this.VMSDataSet.Genre.Rows.Add(genreRow);

row.Genre_ID = -1;

this.VMSDataSet.MovieGenre.Rows.Add(row);
Posted
Comments
[no name] 11-Aug-12 20:44pm    
And? You must have some sort of a problem or question...
[no name] 12-Aug-12 15:55pm    
the genreRow will add but the row does not.
I always accept the changes at form clothing event by user confirmation.
So I want to add them to dataSet first.

1 solution

I Update to database just genreRow then retrieve its ID.
There is noway else.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900