hi,
I have a method which does sql database backup and restore. since this can be time consuming activity
so i am collecting relevant data in a dataTable and then trying to pass those as parameter in the method
Parallel.ForEach(dtRestoreQueue.AsEnumerable(), drow =>
{
PerformDBBackup(drow["Source backup Directory"].ToString(), drow["Source Server Database"].ToString(), drow["Destination backup Directory"].ToString(), drow["Source Server Instance"].ToString(), drow["Destination Server Instance"].ToString(), Convert.ToBoolean(drow["Source Integrated Security"].ToString()), drow["Source User Name"].ToString(), drow["Source Password"].ToString(), drow["Destination Data Directory"].ToString(), drow["Destination Log Directory"].ToString(), drow["Restore Database Name"].ToString());
});
but this is not working and i am getting wierd error like file is in use like that
but whenever i am doing the same with for loop the code is working fine as expected
could you please let me know how to call the this method in parallel any other way to do this.