tgoffice

tgoffice

  • NA
  • 1
  • 0

Multithreading and DataSet, DataTable, DataRow

Jun 9 2004 5:40 PM
Hello, if you have defined a DataSet in the HttpApplicationState which is shared by all current users ... what I have to do, to make the Dataset, DataTables and DataRows thread-safe? Following my assumptions: 1) If I change a Row: lock (datarow) { datarow["xy"] = value; } 2) If I add Rows lock (datatable) { datatable.Rows.Add(..) } 3) If I use the Fill method lock (datatable) { adpt.Fill(datatable); // what happens with changed or currently locked datarows? // e.g: process 1 locks row X of datatable A thread 2 wants to lock datatable A, is process 2 waiting for process 1 to unlock row A } 4) If I make AcceptChanges to DataTable or DataRow lock (datatable) { datatable.AcceptChanges(); } 5) For datatable.Remove (lock datatable) 6) For datarow.Delete() (lock datarow) 7) For dataset.Tables.Add() (lock dataset) 8) If I do a datatable.select(...) what a have to do to make it thread-safe? Is this correct or completly wrong? in your applicatoin writes on rows can only be done by one user at the same time, reading should be possible for all users "at the same time". Maybe yo have some answers... Thank u! Thomas Gasser