DataAdapter and Update command

  • Thread starter Thread starter Julia Sats
  • Start date Start date
J

Julia Sats

Hi,
This is code from MSDN help (OracleDataAdapter.UpdateCommand Property)

' Create the UpdateCommand.

cmd = New OracleCommand("UPDATE Dept SET DeptNo = pDeptNo, DName = pDName
" & _
"WHERE DeptNo = poldDeptNo", conn)

cmd.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo")
cmd.Parameters.Add("pDName", OracleType.NVarChar, 14, "DName")

parm = cmd.Parameters.Add("poldDeptNo", OracleType.Number, 2, "DeptNo")
parm.SourceVersion = DataRowVersion.Original

da.UpdateCommand = cmd


After information inside Dataset would be changed I can call Update method
for updating my DB, like it:

da.Update(myDataset)

but how I can pass parameters ??
and if I do not need to pass parameters why they need ?

I use Janus GridEx control and when I check RowState - information really
changed, but I can not update this information to DB

Thanks
 
Hi,
U need not set the parm values explicitly, based on the
row state, the command will be executed with underlying
data of the datarow.



Regards
Mahesh
-----Original Message-----
Hi,
This is code from MSDN help
(OracleDataAdapter.UpdateCommand Property)
' Create the UpdateCommand.

cmd = New OracleCommand("UPDATE Dept SET DeptNo = pDeptNo, DName = pDName
" & _
"WHERE DeptNo = poldDeptNo", conn)

cmd.Parameters.Add("pDeptNo", OracleType.Number, 2, "DeptNo")
cmd.Parameters.Add("pDName", OracleType.NVarChar, 14, "DName")

parm = cmd.Parameters.Add("poldDeptNo",
OracleType.Number, 2, "DeptNo")
 
Are your changes being successfully updated in the underlying database ?

If not, what problems are you experiencing, are you getting an exception ?

Regards OHM
 
Back
Top