Results 1 to 7 of 7

Thread: ADO: Delete All records at once

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    ADO: Delete All records at once

    Hi,

    what is the best way to delete ALL records in a recordset?
    I would like to know it in ADO and how i can use for it a SQL-command.

    Franky

  2. #2
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    For Access:
    DELETE FROM TableName [WHERE (Condition)]
    For SQL Server:
    TRUNCATE TABLE TableName

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Nov 2001
    Location
    Bangkok
    Posts
    969

    Hi Axion

    Thanks for the fast reply
    This I knew already, hehe .......

    But I want to make it in an ADO way.


    Franky

  4. #4
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    you can use axion_sa way, using ADO... or am I missing something here ? (would not be the first time )

    VB Code:
    1. sConnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test.mdb"
    2.     cnn.Open sConnString
    3.     cnn.Execute "DELETE FROM TableName [WHERE (Condition)] "
    -= a peet post =-

  5. #5
    Frenzied Member oh1mie's Avatar
    Join Date
    Sep 2001
    Location
    Finland
    Posts
    1,043
    How you get that work with Access, i cant ?
    (It works great with SQL Server but Access)
    VB Code:
    1. db.execute "delete from table.....
    2. I need to use
    3. dbexecute " delete * from table.....
    Last edited by oh1mie; Jul 2nd, 2002 at 02:56 AM.
    oh1mie/Vic


  6. #6
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    Originally posted by oh1mie
    How you get that work with Access, I cant ?
    (It works great wit SQL Server but Access)
    VB Code:
    1. db.execute "delete from table.....
    2. I need to use
    3. dbexecute " delete * from table.....
    you are abs. right oh1mie.
    -= a peet post =-

  7. #7
    Frenzied Member axion_sa's Avatar
    Join Date
    Jan 2002
    Location
    Joburg, RSA
    Posts
    1,724
    whoops my bad

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