Bulk delete records from .TPS database using OBDC Topspeed driver or Topscan


How would I go about to do a bulk record delete on a .TPS database?

I've been trying with the ODBC V4 Topspeed driver in C# but each time I execute the delete command the program would just start hanging or if I add code to close the db (cnn.Close()) after the cmd.ExecuteNonQuery() method, the program crashes with the following error: The program '[12345] abcdefg.exe' has exited with code -1073741819 (0xc0000005) 'Access violation'.. Note: Topscan is closed while performing these operations. (I have had success with SELECT queries so the connection string and so on is correct)

Example of the SQL command via the ODBC Topspeed driver: "DELETE FROM table WHERE column = '12345'"

Example of delete command:

public void deleteCommand(string sqlCommand)
            string connectionString = database_a_string;
            OdbcConnection cnn = new OdbcConnection(connectionString);
            OdbcCommand cmd = new OdbcCommand(sqlCommand, cnn);
        catch (Exception ex)
            MessageBox.Show("Topspeed error: " + ex, "Delete Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

Maybe I could use Topscan instead? But I have only seen a way to delete records individually. This DB has over 900 000 records.

Edit: I was able to execute an insert command successfully with the same method format. I have a hunch the OBDC V4 Topspeed driver is causing the "Access Violation" error.

asked on Stack Overflow Nov 3, 2020 by hellmit100 • edited Nov 3, 2020 by hellmit100

0 Answers

Nobody has answered this question yet.

User contributions licensed under CC BY-SA 3.0