Updating Additional Fields

  • Thread starter Thread starter Jim Heavey
  • Start date Start date
J

Jim Heavey

Suppose I have a datatable with the following fields:

Movie_ID
Movie_Description

I have a SQL Proc which takes a @QTY parameter and creates a new
"Movie_ID" (the value in the datatable is null) and then creates a series
of Tape Numbers in another table.

My question is, if I run the Adapter.Update method will it automatcially
update "Movie_ID" when a new Movie_ID is "generated" by the stored
procedure?

The second question is, If the stored procedure returns a list of
"Tape_Numbers", is there some way that I can update another "datatable"
with those Tape Numbers? I could change this procedure to return the
Movie_ID as well as the tape number if the movie ID would not automatically
be updated.

Thanks in advance for your assistance!!!!!!!!!!
 
1. you need to return new movieid from sp explicitly with write select
statement after your insert statement.

e.g.

insert into <table> (columns) values (@parameters)
select @@identity/scope_identity()

2. for retrieve tapenumbers in another table. you need to call fill method
of dataadapter after update statement of dataadapter

e.g. daMovie.update(dtMovies)
dtTapes.rows.clear()
daTapes.fill(dtTapes)

Rajesh Patel
 
Back
Top