G
Guest
I am using a DataGrid with a dataset and the
OracleDataAdapter.Fill(dataset,"Tablename") method. All is fine: a table is
created and mapped to the dataset and data is shown in the datagrid.
When I clear the table, dispose it and remove it from the dataset, and then
reload the same table with the fill statement, the datagrid shows (NULL)
although the debug output shows that there is a table mapped to the dataset
with populated rows. Although when I try to remove it again by index from the
DataSet, I get a NullPointerException - but the Table is present!
What am I missing? If anyone can verify this strange behaviour?
Test-Code is like this:
namespace TestDsLoadClear
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
/// <summary>
/// DeleteButton
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
dataSet1.Tables[0].Clear();
dataSet1.Tables[0].Dispose();
dataSet1.Tables.RemoveAt(0);
button2.Enabled = false;
button1.Enabled = true;
}
/// <summary>
/// LoadButton
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
oracleDataAdapter1.Fill(dataSet1, "NewTable");
button1.Enabled = false;
button2.Enabled = true;
}
}
}
OracleDataAdapter.Fill(dataset,"Tablename") method. All is fine: a table is
created and mapped to the dataset and data is shown in the datagrid.
When I clear the table, dispose it and remove it from the dataset, and then
reload the same table with the fill statement, the datagrid shows (NULL)
although the debug output shows that there is a table mapped to the dataset
with populated rows. Although when I try to remove it again by index from the
DataSet, I get a NullPointerException - but the Table is present!
What am I missing? If anyone can verify this strange behaviour?
Test-Code is like this:
namespace TestDsLoadClear
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
/// <summary>
/// DeleteButton
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button2_Click(object sender, EventArgs e)
{
dataSet1.Tables[0].Clear();
dataSet1.Tables[0].Dispose();
dataSet1.Tables.RemoveAt(0);
button2.Enabled = false;
button1.Enabled = true;
}
/// <summary>
/// LoadButton
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void button1_Click(object sender, EventArgs e)
{
oracleDataAdapter1.Fill(dataSet1, "NewTable");
button1.Enabled = false;
button2.Enabled = true;
}
}
}