U
user
Hello,
I'm trying to call a Fill method from a DataAdapter object on a seperate
thread.
The Application crashes without seeming to throw any exceptions. Both of
these methods are in the same class.
Here is my source code:
public void Fill()
{
try
{
string commandText = da.SelectCommand.CommandText;
string where = "";
lock(da)
{
if (RowFilter != "")
{
where = " Where " + RowFilter;
da.SelectCommand.CommandText += where;
}
currentThread = new Thread(new ThreadStart(FillDataSet));
currentThread.Name = _table.TableName + " Fill";
currentThread.Priority = ThreadPriority.Normal;
currentThread.IsBackground = true;
currentThread.Start();
if (where != "")
{
da.SelectCommand.CommandText = commandText;
}
}
}
catch(Exception ex)
{
throw ex;
}
}
private void FillDataSet()
{
try
{
lock(_table)
{
MessageBox.Show(this.ToString());
da.Fill(_table);
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
throw ex;
}
}
Thank You,
Brian Takita
I'm trying to call a Fill method from a DataAdapter object on a seperate
thread.
The Application crashes without seeming to throw any exceptions. Both of
these methods are in the same class.
Here is my source code:
public void Fill()
{
try
{
string commandText = da.SelectCommand.CommandText;
string where = "";
lock(da)
{
if (RowFilter != "")
{
where = " Where " + RowFilter;
da.SelectCommand.CommandText += where;
}
currentThread = new Thread(new ThreadStart(FillDataSet));
currentThread.Name = _table.TableName + " Fill";
currentThread.Priority = ThreadPriority.Normal;
currentThread.IsBackground = true;
currentThread.Start();
if (where != "")
{
da.SelectCommand.CommandText = commandText;
}
}
}
catch(Exception ex)
{
throw ex;
}
}
private void FillDataSet()
{
try
{
lock(_table)
{
MessageBox.Show(this.ToString());
da.Fill(_table);
}
}
catch(Exception ex)
{
MessageBox.Show(ex.Message);
throw ex;
}
}
Thank You,
Brian Takita