E
erdem
hi,
i have problem about object references,,
lets say: i have a typed dataset (name: "dsall")
it has datatables table1 , table2
there are dataadapters which fills these and there are also
datagrids,comboboxes etc which are binded to this dataset
then i write this code to FORM_LOAD
//create thread in order not to wait getting process
private void formload(.......,.....)
{
Thread thr =new Thread(new ThreadStart(xx));
thr.isBackGround = true;
thr.Start();
//other things
}
private void xx()
{
adapter1.Fill(dsAll.Table1);
adapter1.Fill(dsAll.Table2);
//etc etc..
}
here is problem
when this code is executed, Null Reference exception is thrown
as i understand adapter1 creates datatable in thread scope and because
thread is ended, garbage collector collects datatable so i get null
reference exception, i say this because if i use this form there is no
error.
private void formload(.......,.....)
{
//dont use thread
//Thread thr =new Thread(new ThreadStart(xx));
//thr.Start();
//call directly function
xx();
//other things
}
but i need to fill dataset with thread
Thanks in advance
Erdem...
i have problem about object references,,
lets say: i have a typed dataset (name: "dsall")
it has datatables table1 , table2
there are dataadapters which fills these and there are also
datagrids,comboboxes etc which are binded to this dataset
then i write this code to FORM_LOAD
//create thread in order not to wait getting process
private void formload(.......,.....)
{
Thread thr =new Thread(new ThreadStart(xx));
thr.isBackGround = true;
thr.Start();
//other things
}
private void xx()
{
adapter1.Fill(dsAll.Table1);
adapter1.Fill(dsAll.Table2);
//etc etc..
}
here is problem
when this code is executed, Null Reference exception is thrown
as i understand adapter1 creates datatable in thread scope and because
thread is ended, garbage collector collects datatable so i get null
reference exception, i say this because if i use this form there is no
error.
private void formload(.......,.....)
{
//dont use thread
//Thread thr =new Thread(new ThreadStart(xx));
//thr.Start();
//call directly function
xx();
//other things
}
but i need to fill dataset with thread
Thanks in advance
Erdem...