private void newBtn_Click(object sender, RoutedEventArgs e)
{
try
{
if (txtDayfind.Text == "" || txtDatefind.Text == "" ||
txtTimefind.Text == "" || txtLatfind.Text == "" ||
txtLongfind.Text == "" || txtAddressfind.Text == "" ||
txtaccuracy.Text == "" || txtTypefind.Text == "")
{
Button button = sender as Button;
string content = button.Content.ToString();
foreach (DataTable table in dsr.Tables)
{
if (table.TableName == content)
{
dataGrid1.ItemsSource = table.DefaultView;
dtselect = table;
}
}
}
else
{
dataGrid1.ItemsSource = dtselect.DefaultView;
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
I am trying to display data from DataTable to Datagrid but DataTable contains more than 0.2 Million rows so it gives System.OutOfMemoryException. And I am not able to display data and application stop working.
Please help me to resolve System.OutOfMemoryException this issue.
I have one dataset which contains multiple tables when DataTable has small data it works fine, but when DataTable have big data it consumes more space and give System.outofmemoryexception.