CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Jul 2000
    Posts
    135

    deleting DataBase

    I am using VB6 to maintain Access 2000 tables. I need to delete tables and repopulate them with data from our main. Our customer table is 25,000 records and the only way I have found to delete the table is to go through the records one by one and delete them. The delete process on this one table alone takes about 30 minutes.

    Is there a way to copy the table setup (variables, relationships etc), delete the entire table and recreate it using the copy?

    Thanks in advance.

    Ray


  2. #2
    Join Date
    Jan 2000
    Location
    Olen, Belgium
    Posts
    2,477

    Re: deleting DataBase

    I can't give you an answer to the copy/create stuff, but you can delete all the records from a table using a SQL statement:

    DELETE FROM myTable
    DELETE * FROM myTable



    If the first one (without the *) shouldn't work, use the second, but normally, it should work, and leave you with an empty table.

    Tom Cannaerts
    [email protected]

    Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning -- Rich Cook
    Tom Cannaerts
    email: [email protected]
    www.tom.be (dutch site)

  3. #3
    Join Date
    Jul 2000
    Posts
    135

    Re: deleting DataBase

    I am using adodc and I can't find any command to execute a sql. Everything I read says db.execute, but, I can't find an execute.

    It seems like I can use Delete with a filter, but, I haven't been able to figure out how to use it. The help has no examples of deleting an entire table.

    I have tried:

    db.filer = "DELETE * FROM mytable"
    db.delete adeffectgroup
    db.updatebatch

    the filer statement gets an error.
    Do you know how to use filer/delete.

    Thanks in advance


  4. #4
    Join Date
    Jan 2000
    Location
    Saskatchewan, Canada
    Posts
    595

    Re: deleting DataBase

    Can't you use SQL?

    dim strSQL as string
    strSQL = "DELETE * FROM YourTable"
    cnYourConnection.execute strsql

    It should process faster, probably less than 10 sec.


    David Paulson


  5. #5
    Join Date
    Jan 2000
    Location
    Saskatchewan, Canada
    Posts
    595

    Re: deleting DataBase

    With the adodc control this seems to work

    Adodc1.RecordSource = "DELETE * FROM YourTable"




    David Paulson


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured