My Vizai

Hi all

I'm getting "DataTable internal index is corrupted: '5' this error when I'm modifying the content in a datatable.

I'm running 4 threads at a time, and each thread executes a common method(one method for all threads).

In that method I'm changing the Datatable , there I'm getting this error.

Is there any problem with multiple threads accessing same table at a time

Can Anybosy help me in this.

Thanks in advacne




Re: Windows Forms Data Controls and Databinding Error : DataTable internal index is corrupted: '5'

Ken Tucker

If more than one thread are trying to change the datatable at the same time you will get an error. You can use SyncLock in VB or Lock in C# to prevent more than more thread from updating the datatable at a time




Re: Windows Forms Data Controls and Databinding Error : DataTable internal index is corrupted: '5'

My Vizai

Thanks for the reply Ken

But I'm updations of Datatable spanning thru out the method.

How to handle this.can help me.






Re: Windows Forms Data Controls and Databinding Error : DataTable internal index is corrupted: '5'

Ken Tucker

What I am thinking is more than one thread is trying to modify the datatable at once causing the error.  Try to lock (or synclock vb) the datatable so only one thread can modify the table at a time. Try something like this



lock (YourDataTable)
{
// do something with the data table
}


 






Re: Windows Forms Data Controls and Databinding Error : DataTable internal index is corrupted: '5'

My Vizai

Thank you Ken

But still I'm updating Gridview also.

The application is behaving unexpectedly.






Re: Windows Forms Data Controls and Databinding Error : DataTable internal index is corrupted: '5'

Ken Tucker

Post some code