none
Error HY001 writting DBF RRS feed

  • Question


  • Hello!

    I'm updating a DBF database reading the new records from a txt. When the program has processed around 2000 records, it shows an exception saying something like Error ODBC HY001. Impossible to open more tables.

    I've been searching info about thar error and I've found out that it is a memory problem. I've tried to reduce the number of queries and the number of writting, but it doesn't writes more than 2500 records.

    The string connection I'm using is this one:
    string connectionString = "Dsn=dBASE Files;dbq=" + dbpath + ";defaultdir=" + dbpath + ";driverid=533;maxbuffersize=2048;pagetimeout=5";

    The code is the following:

    Code Snippet

    OdbcConnection conn = null;
    OdbcCommand comm = null;
    OdbcDataReader dr = null;
    conn = new OdbcConnection(connectionString);
    conn.Open();

    while (line != null && contline <2400)
                {

           try {

    sql = select + "'" + splitted[0] + "'";
    comm = new OdbcCommand(sql, conn);
    dr = comm.ExecuteReader();
    comm.Dispose();
    if (dr.Read() == true){                   
             sql = update1+"'"+splitted[3]+"'"+update2+"'"+splitted[0]+"'";

                       comm = new OdbcCommand(sql, conn);
                       dr = comm.ExecuteReader();
                       comm.Dispose();                           
                   }

                   else{
                       sql =insert+"'"+splitted[0]+"')";
                       comm = new OdbcCommand(sql, conn);
                       dr = comm.ExecuteReader();
                       comm.Dispose();
                   }
                   dr.Close();
                   }
                   catch (OdbcException oe){
                        MessageBox.Show("An ODBC exception occurred: " + oe.Message.ToString());
                   }
                   catch (Exception e){
                         MessageBox.Show("An exception occurred: " + e.Message.ToString());
                        }

    }


    conn.Dispose();




    Any guess why it is failing?

    Thanks for your time!
    Tuesday, April 1, 2008 10:06 AM