Click here to Skip to main content
15,890,185 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
My application connects to a data base and starts to read data after a while i got the message below: "Impossible to execute the request. The request result size is higher than the database size(2 Go) or, temporary space folder on the disk is insufficient to store the result".

Any idea on how to overcome this problem??
Please try to be clear and give examples if possible.
Thanks

My code is givien below:
C#
public DataTable read(string query)
{   
   OleDbDataReader dr;
   // Connecting to the data base
   conn.ConnectionString = ConString;
   // Prepare SQL query
          
   try
   {
      if (conn.State != ConnectionState.Open)
         conn.Open();

   }
   catch (OleDbException ex)
   {
      System.Windows.Forms.MessageBox.Show("Failed to connect to data source " + ex.Message);
   }

   try
   {
      // Run the query and create a record set
      OleDbCommand cmd = new OleDbCommand(query, conn);
      dr= cmd.ExecuteReader();
      /*  Console.WriteLine("Retrieve schema info for the given result set:");
      for (int column = 0; column < dr.FieldCount; column++)
      {
         Console.Write(" |" + dr.GetName(column));
      }
      while (dr.Read())
      {
         Console.WriteLine("dal: " + dr.GetValue(0).ToString() + " | " + dr.GetValue(1).ToString());
      }*/
      dt.Load(dr);
      dr.Close();
   }
   catch (OleDbException ex)
   {
      System.Windows.Forms.MessageBox.Show("There might be a problem while recording the dataset " + ex.Message);
   }
   finally
   {
      conn.Close();
   }
   return dt;
}


additional information copied from comment below
This is the query: I use Access database

SQL
string queryC = "SELECT DISTINCT dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.TAUX_OCCUPATION, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_EQPT_A, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.PORT_A, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_EQPT_B, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.PORT_B, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_SLOT_A, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_SLOT_B FROM dbo_BOGEDOTXM_OCCUP_LIENS_SDH INNER JOIN ((dbo_EQUIPEMENT INNER JOIN dbo_OSMOSE_SITE_GEOGRAPHIQUE ON dbo_EQUIPEMENT.NUM_SITE_GEO = dbo_OSMOSE_SITE_GEOGRAPHIQUE.NUM_SITE_GEO) INNER JOIN dbo_OSMOSE_OPERATION ON dbo_OSMOSE_SITE_GEOGRAPHIQUE.NUM_SITE_GEO = dbo_OSMOSE_OPERATION.NUM_SITE_GEO) ON dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_EQPT_A = dbo_EQUIPEMENT.NOM_EQUIPEMENT WHERE (( (dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN) Like '%AT%' Or (dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN) Like '%BT%' Or (dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN) Like '%CT%' Or (dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN) Like '%DT%') AND ((dbo_OSMOSE_OPERATION.REGION_EXPLOITATION)=" + region + "));";
Posted
Updated 9-Sep-14 7:36am
v6
Comments
[no name] 7-Sep-14 17:53pm    
Try querying data that is less than the size of the database or free up some room on the disk.
orélle 7-Sep-14 18:01pm    
When the size of the data fits, it works. What is the location of the temporary folder?
I have a lot of free space on my disk anyway. If might be possible to increase the defautt value of the database result to more than 2 Go it will overcome the issue.
George Jonsson 7-Sep-14 22:53pm    
Maybe you should show the query that is causing the problem.
Thomas Nielsen - getCore 9-Sep-14 2:56am    
Is this an oracle backend or Access?
orélle 9-Sep-14 7:19am    
This is the query: I use Access database

string queryC = "SELECT DISTINCT dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.TAUX_OCCUPATION, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_EQPT_A, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.PORT_A, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_EQPT_B, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.PORT_B, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_SLOT_A, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_SLOT_B FROM dbo_BOGEDOTXM_OCCUP_LIENS_SDH INNER JOIN ((dbo_EQUIPEMENT INNER JOIN dbo_OSMOSE_SITE_GEOGRAPHIQUE ON dbo_EQUIPEMENT.NUM_SITE_GEO = dbo_OSMOSE_SITE_GEOGRAPHIQUE.NUM_SITE_GEO) INNER JOIN dbo_OSMOSE_OPERATION ON dbo_OSMOSE_SITE_GEOGRAPHIQUE.NUM_SITE_GEO = dbo_OSMOSE_OPERATION.NUM_SITE_GEO) ON dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_EQPT_A = dbo_EQUIPEMENT.NOM_EQUIPEMENT WHERE (( (dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN) Like '%AT%' Or (dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN) Like '%BT%' Or (dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN) Like '%CT%' Or (dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN) Like '%DT%') AND ((dbo_OSMOSE_OPERATION.REGION_EXPLOITATION)=" + region + "));";

If the database value are stored in database, then there is no issue regarding the space while retrieving the data from database. There may be issue in your query / Stored procedure that is used to fetch the data from database.
 
Share this answer
 
Comments
orélle 9-Sep-14 7:23am    
i have posted the query above. The query runs well if i execute directly on access so it's correct, the issue is while reading data in my application. Thanks
It is better to change the database from Microsoft Access to Microsoft SQL Server, which you can install separately or use the in build SQL Server Express that is available with in Visual Studio.
 
Share this answer
 
Comments
orélle 9-Sep-14 8:39am    
Thanks for your suggestion but the problem is that i'm not admin on my computer then i can not install whatever i want!! :(
Hi, Could you try this, may this help you,
SQL
string queryC = "SELECT
DISTINCT dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.TAUX_OCCUPATION, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_EQPT_A,
dbo_BOGEDOTXM_OCCUP_LIENS_SDH.PORT_A, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_EQPT_B, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.PORT_B,
dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_SLOT_A, dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_SLOT_B

FROM dbo_BOGEDOTXM_OCCUP_LIENS_SDH
INNER JOIN dbo_EQUIPEMENT ON dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_EQPT_A = dbo_EQUIPEMENT.NOM_EQUIPEMENT
INNER JOIN dbo_OSMOSE_SITE_GEOGRAPHIQUE ON dbo_EQUIPEMENT.NUM_SITE_GEO = dbo_OSMOSE_SITE_GEOGRAPHIQUE.NUM_SITE_GEO
INNER JOIN dbo_OSMOSE_OPERATION ON dbo_OSMOSE_SITE_GEOGRAPHIQUE.NUM_SITE_GEO = dbo_OSMOSE_OPERATION.NUM_SITE_GEO

WHERE (( (dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN) Like '%AT%'
Or (dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN) Like '%BT%'
Or (dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN) Like '%CT%'
Or (dbo_BOGEDOTXM_OCCUP_LIENS_SDH.NOM_LIEN) Like '%DT%')
AND ((dbo_OSMOSE_OPERATION.REGION_EXPLOITATION)=" + region +  "))";

Please give me your feedback,
 
Share this answer
 
Comments
orélle 10-Sep-14 9:29am    
I have tried your solution, i got a bug telling that parenthesis are absents. Thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900