|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
using command to pass old and new valuesI'm trying to find an example of using oracle command utilizing both the original and new values of a dataset (datatable) to pass into a stored procedure. For example, ---------SNIP ---------------- OracleCommand updateCommand = new OracleCommand("UpdateLocations",conn); updateCommand.commandType = commandType.storedProcedure; updateCommand.Parameters.Add("p_loc_id", OracleType.Number,4,"LOC_ID"); updateCommand.Parameters.Add("p_address",OracleType.Varchar,100,"ADDR"); da.UpdateCommand = updateCommand; ---------SNIP ---------------- This proc will update the address for the loc_id. I want to be able to pass in one more variable, the "old address" to compare and make sure that the address in the database hasn't changed since I originally retrieved the row (kind of like using the last rowupdate timestamp to ensure the data hasn't changed) How can I add specify this in another parameter for the call... something like: ---------SNIP ---------------- updateCommand.Parameters.Add("p_address_old",OracleType.Varchar,100 ........) ---------SNIP ---------------- Thanks in advance, Mike Hi,
<anonym***@gmail.com> wrote in message Show quote news:1137625451.919152.263390@o13g2000cwo.googlegroups.com... Change the SourceVersion on the Parameter:> Hello, > > I'm trying to find an example of using oracle command utilizing both > the original and new values of a dataset (datatable) to pass into a > stored procedure. > > For example, > > ---------SNIP ---------------- > OracleCommand updateCommand = new > OracleCommand("UpdateLocations",conn); > > updateCommand.commandType = commandType.storedProcedure; > > updateCommand.Parameters.Add("p_loc_id", OracleType.Number,4,"LOC_ID"); > updateCommand.Parameters.Add("p_address",OracleType.Varchar,100,"ADDR"); > > da.UpdateCommand = updateCommand; > > ---------SNIP ---------------- > > This proc will update the address for the loc_id. I want to be able to > pass in one more variable, the "old address" to compare and make sure > that the address in the database hasn't changed since I originally > retrieved the row (kind of like using the last rowupdate timestamp to > ensure the data hasn't changed) > > How can I add specify this in another parameter for the call... > something like: > > ---------SNIP ---------------- OracleParameter p = updateCommand.Parameters.Add("p_address_old",OracleType.Varchar,100, "ADDR"); p.SourceVersion = DataRowVersion.Original; HTH, Greetings Show quote > > ---------SNIP ---------------- > > > Thanks in advance, > Mike > |
|||||||||||||||||||||||