Click here to Skip to main content
15,896,310 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
foreach (DataRow row in dssetparameter.Tables[0].Rows)
  {
 selectquery += " select '" + row["itemID"] +"'; as unit_param_id ,'" + row["paramvalue"] + '" as param_value,'" + row["date_logged"] +"' as date_logged ,'" + row["date_logged1"] + "' as OPCdate_logged,'" + row["Quality"] + "' as param_quality Union ALL" + Environment.NewLine;
  }
  if (selectquery != "")
 {
 selectquery = selectquery.Remove(selectquery.LastIndexOf("Union"));
 insertquery += " insert into " + tablename + "  " + Environment.NewLine;
  insertquery += " (unit_param_id,param_value,date_logged,OPCdate_logged,param_quality)" + Environment.NewLine;
  insertquery += " " + selectquery + " ";
                                if (con2.State == ConnectionState.Closed)
                                    con2.Open();
                                cmd2 = new OdbcCommand(insertquery, con2);
                                    cmd2.CommandTimeout = 500;
                                    cmd2.ExecuteNonQuery();


                                if (con2.State == ConnectionState.Open)
                                    con2.Close();
                            }

i have write this query inserting the 7000 row at every 1000 millisecond using threading .But when i will be excute this query it will be thrown exception as

"
C++
ERROR [42000] [MySQL][ODBC 3.51 Driver][mysqld-6.0.11-alpha-community]memory exhausted near ''5332' as unit_param_id ,'' as param_value,'' as date_logged ,'' as OPCdate_logg' at line 5334

"
please help me
thanks in advance..........
Posted

1 solution

First switch to MySql Connector/Net[^] driver. The MySql Odbc v 3.51 is a very old driver.

Then rethink the code about the INSERT ... SELECT statement.
 
Share this answer
 
Comments
vrushali katkade 23-Jun-11 3:38am    
the same exception using this MYSQL connector 6.3.6
Kim Togo 23-Jun-11 12:00pm    
I think you are generation an all to big sized/length SQL statement. Rethink the INSERT ... SELECT logic.
Espen Harlinn 25-Jun-11 13:44pm    
Good effort, my 5
Kim Togo 27-Jun-11 3:34am    
Thanks Espen

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