[quote] acuty i want fetch data from orcale data base... through dataadpter in grid view [/quote] So how big are your datasets? Millions of records? In which case you will more than likely indeed run into memory issues. If you want to display them in a grid, use custom paging. It does not make sense to retrieve one million records and only display e.g. 50. Retrieve 50, retrieve the next 50, the next 50 etc etc. Do NOT use the brain-dead paging that comes with the gridview.
I don't know data adapters, so can't advise; for mysql / mssql I'm always using something like
string strconnection = "Data Source=WIM_LT-PC\\SQL2012;Initial Catalog=testje;User ID=northwind;Password=northwind"; using (SqlConnection con = new SqlConnection(strconnection)) { con.Open();
string sSQL = "select disp_user_code from disp_user where disp_user_code = @sID"; using (SqlCommand cmd = new SqlCommand(sSQL, con)) { DataTable tbl2 = new DataTable();
Although not necessarily the case, you might very well have some flaws in your software. Scrutinize all your code (and possibly your design). Cleanup any variables that you no longer need after usage.
As a demo, the below will throw an outofmemory exception on my system when I try to allocate memory for for b2.
static void Main(string[] args) { byte[] b0 = new byte[400000000]; byte[] b1 = new byte[400000000]; // do something with b0 and b1
byte[] b2 = new byte[400000000]; byte[] b3 = new byte[400000000]; byte[] b4 = new byte[400000000]; byte[] b5 = new byte[400000000]; byte[] b6 = new byte[400000000]; byte[] b7 = new byte[400000000]; byte[] b8 = new byte[400000000]; byte[] b9 = new byte[400000000]; }
By cleaning up b0 or b1 before attempting to allocate memory for b2, the error moves to allocation of memory for b3.
static void Main(string[] args) { byte[] b0 = new byte[400000000]; byte[] b1 = new byte[400000000]; // do something with b0 and b1
// we no longer need b0 b0 = null;
byte[] b2 = new byte[400000000]; byte[] b3 = new byte[400000000]; byte[] b4 = new byte[400000000]; byte[] b5 = new byte[400000000]; byte[] b6 = new byte[400000000]; byte[] b7 = new byte[400000000]; byte[] b8 = new byte[400000000]; byte[] b9 = new byte[400000000]; }
As said, scrutinize your code. To make live for the garbage collector easier, tell it what you no longer need.
Make use of using statements wherever possible.
Set variables to null (when applicable) when no longer needed
akash singhPosted Jan 6, 2015, 1:41 AM
akash singhPosted Jan 6, 2015, 1:41 AM
akash singhPosted Jan 6, 2015, 1:41 AM
akash singhPosted Jan 6, 2015, 1:41 AM
Wim SturkenboomPosted Jan 3, 2015, 7:48 AM
Sorry to say, but this is an insane requirement.
akash singhPosted Jan 3, 2015, 12:17 AM
Wim SturkenboomPosted Jan 2, 2015, 7:11 AM
acuty i want fetch data from orcale data base... through dataadpter in grid view
[/quote]
So how big are your datasets? Millions of records? In which case you will more than likely indeed run into memory issues. If you want to display them in a grid, use custom paging. It does not make sense to retrieve one million records and only display e.g. 50. Retrieve 50, retrieve the next 50, the next 50 etc etc. Do NOT use the brain-dead paging that comes with the gridview.
I don't know data adapters, so can't advise; for mysql / mssql I'm always using something like
string strconnection = "Data Source=WIM_LT-PC\\SQL2012;Initial Catalog=testje;User ID=northwind;Password=northwind";
using (SqlConnection con = new SqlConnection(strconnection))
{
con.Open();
string sSQL = "select disp_user_code from disp_user where disp_user_code = @sID";
using (SqlCommand cmd = new SqlCommand(sSQL, con))
{
DataTable tbl2 = new DataTable();
cmd.CommandType = CommandType.Text;
cmd.Parameters.AddWithValue("@sID", someid);
tbl2.Load(cmd.ExecuteReader());
if (tbl2.Rows.Count != 0)
{
// someid already exists
// inform user
// return
return;
}
}
}
And next I bind the datatable (tbl2) to the gridview in code behind.
The using statements make sure that you correctly dispose your objects after use.
akash singhPosted Jan 2, 2015, 3:55 AM
Wim SturkenboomPosted Jan 2, 2015, 2:00 AM
As a demo, the below will throw an outofmemory exception on my system when I try to allocate memory for for b2.
static void Main(string[] args)
{
byte[] b0 = new byte[400000000];
byte[] b1 = new byte[400000000];
// do something with b0 and b1
byte[] b2 = new byte[400000000];
byte[] b3 = new byte[400000000];
byte[] b4 = new byte[400000000];
byte[] b5 = new byte[400000000];
byte[] b6 = new byte[400000000];
byte[] b7 = new byte[400000000];
byte[] b8 = new byte[400000000];
byte[] b9 = new byte[400000000];
}
By cleaning up b0 or b1 before attempting to allocate memory for b2, the error moves to allocation of memory for b3.
static void Main(string[] args)
{
byte[] b0 = new byte[400000000];
byte[] b1 = new byte[400000000];
// do something with b0 and b1
// we no longer need b0
b0 = null;
byte[] b2 = new byte[400000000];
byte[] b3 = new byte[400000000];
byte[] b4 = new byte[400000000];
byte[] b5 = new byte[400000000];
byte[] b6 = new byte[400000000];
byte[] b7 = new byte[400000000];
byte[] b8 = new byte[400000000];
byte[] b9 = new byte[400000000];
}
As said, scrutinize your code.
To make live for the garbage collector easier, tell it what you no longer need.
akash singhPosted Jan 2, 2015, 1:33 AM
Rajagopalan R VPosted Jan 2, 2015, 1:30 AM
This Happen Whenever Your System Space Gets Full it Will Occur Please Clear Temp Files in Your Machine And Then Execute , Then it will Work
Hope It Helps You
Regards.....,
R.V.Rajagopalan
If This Helps You Kindly Mark "This is Correct Answer"