Hi All My Friends
I Connect to DB (Oracle) and execute a select Command (From table that has very records for example 1000000 records) then load in DataGrid in C sharp.it does successfully but very very slowly.
---------------
DataSet ds = new DataSet();
String constr = p_ConnectionStr;
String CommandStr ="SELECT * FROM MTL_SYSTEM_ITEMS";
System.Data.OracleClient.OracleConnection ConOracle = new System.Data.OracleClient.OracleConnection(constr);
System.Data.OracleClient.OracleCommand ComOracle = new System.Data.OracleClient.OracleCommand(CommandStr, ConOracle);
System.Data.OracleClient.OracleDataAdapter AdpOracle = new System.Data.OracleClient.OracleDataAdapter(CommandStr, ConOracle);
ConOracle.Open();
ComOracle.ExecuteScalar();
AdpOracle.Fill(ds, "MTL_SYSTEM_ITEMS");
ConOracle.Close();
---------------
Please Help Me to Find Solutions for solve the Problem.
Best Regards
BABAK
Vijaya KadiyalaPosted Feb 9, 2009, 12:16 PM
Hi
Why do you want to get all 1Million records?? why dont you make use of the pagination?? this way you can limit the No.Of Records that are comming from Database.
Thanks -- Vijaya Kadiyala
http://dotnetvj.blogspot.com
Baubak HarouniPosted Feb 9, 2009, 12:50 AM
Hi Mirko
Thanks for your help.I don't Know why I do it but I correct now it to :
String constr = p_ConnectionStr;
DataSet ds = new DataSet();
System.Data.OracleClient.OracleConnection ConOracle = new System.Data.OracleClient.OracleConnection(constr);
System.Data.OracleClient.OracleDataAdapter AdpOracle = new System.Data.OracleClient.OracleDataAdapter(p_CommandStr, ConOracle);
ConOracle.Open();
AdpOracle.Fill(ds, p_Datamember);
ConOracle.Close();
But still my problem is exist.
Babak
Mirko MeierPosted Feb 8, 2009, 1:52 PM
you run two times the statement. The statement
ComOracle.ExecuteScalar();
runs the query and return the first column of the first row in result.
After that you fill the DataSet.
I would delete the ExecuteScalar-Statement. It is not required.