1

I need help regarding following issue. I am dealing with grid view in asp.net. In this grid view data is bound from a datatable. all insertion, updation and deletion is performed in datatable. On save button click i want this datatable to be updated in database table(database table already exist with some data which is edited in datatable, Datatabase tables columns are same as datatable).

I tried following with oracleBulkCopy

Oracle.DataAccess.Client.OracleBulkCopy oracleBulkCpoy = new Oracle.DataAccess.Client.OracleBulkCopy(DM.ConnectionString);
oracleBulkCpoy.DestinationTableName = "RANGE";
oracleBulkCpoy.WriteToServer(dtRange);

Above code only writing all rows in database table. it is not updating existing rows but creating same row aging with same primary key id.

Do I need any stored procedure?

Any other Suggestions or idea of updating datatable into database...

Plz help.. suggestions, opinions are welcome... Thanx in advance

Soner Gönül
  • 97,193
  • 102
  • 206
  • 364
Pramod
  • 657
  • 4
  • 18
  • 34
  • Posting some code would help @pramod – Devjosh Feb 10 '12 at 07:19
  • this may be helpful http://docs.oracle.com/html/E10927_01/OracleBulkCopyClass.htm and also have a look at this pld SO post http://stackoverflow.com/questions/343299/bulk-insert-to-oracle-using-net – Devjosh Feb 10 '12 at 07:29
  • Thanx for ur response its working.. but when i am writing oracleBulkCopy.WriteToServer it is not editing in existing rows in database table but it is creating same rows again... – Pramod Feb 10 '12 at 09:29
  • can you update your code @pramod with the changes – Devjosh Feb 10 '12 at 09:41
  • Edited in my question @Devjosh – Pramod Feb 10 '12 at 09:59
  • i never used oracle sqlbulkcopy so see this link if there is something useful in it http://dba.stackexchange.com/questions/7287/what-specifically-does-oraclebulkcopy-do-and-how-can-i-optimize-its-performance or http://docs.oracle.com/cd/E15296_01/doc.111/e15167.pdf – Devjosh Feb 10 '12 at 10:00

0 Answers0