Can't delet recordset

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default Can't delet recordset

    When in ASP and an Access database, I can delete all records in a table with
    the code:

    sql = "SELECT * FROM Table "
    Set RS = Server.CreateObject("ADODB.Recordset")
    RS.Open sql, objConn, adLockPessimistic, adCmdTable
    If Not RS.EOF Then
    Do Until RS.EOF
    RS.Delete
    RS.Update
    RS.MoveFirst
    Loop
    End If

    But when I use the same program to a MySQL databse it doesn't work. It will
    only delete the last record and then jump out as if it was ready.

    I am tearing my last hair on this one! - Can anybody tell what is wrong?
    / Rolf



    Rolf Rosenquist Guest

  2. Similar Questions and Discussions

    1. Error when attempting to delet and ODBC DSN
      Hi, We have CFMX 7 Enterprise running on Win2003 (no SP1). We've created another instance of CFMX and are having a lot of trouble with the ODBC...
    2. Is this possible with a recordset?
      Hello, Looking for some expert help. I am using Dreamweaver MX 2004. I have a need that I was wondering if it was possible accomplish using a...
    3. ADO - Recordset
      I was wondering if anyone can help me. I've converting an already existing system (designed in Access which produces reports for the accounts dept)...
    4. RecordSet.Move or RecordSet.AbsolutePosition??
      Hi, I'm trying to use either one of these methods to position the cursor in a specific position inside a recordset, but neither one seems to...
    5. delet command
      Hi, can anybody give me a command which can delet files older than one week or one month for example ? I think there is a command like find......
  3. #2

    Default Re: Can't delet recordset

    Tried your suggestion (that I did not know about) but got this Error
    message:

    Microsoft OLE DB Provider for ODBC Drivers fel '80040e14'

    [MySQL][ODBC 3.51 Driver][mysqld-4.0.14-nt]You have an error in your SQL
    syntax. Check the manual that corresponds to your MySQL server version for
    the right syntax to use near '* FROM Table' at line 1

    The reference manual at [url]http://www.mysql.com/doc/en/DELETE.html[/url] did not
    reveal anything to me.

    / Rolf


    "Bob Barrows" <reb_01501@yahoo.com> skrev i meddelandet
    news:u8zHxMnXDHA.1680@tk2msftngp13.phx.gbl...
    > Rolf Rosenquist wrote:
    > > When in ASP and an Access database, I can delete all records in a
    > > table with the code:
    > >
    > > sql = "SELECT * FROM Table "
    > > Set RS = Server.CreateObject("ADODB.Recordset")
    > > RS.Open sql, objConn, adLockPessimistic, adCmdTable
    > > If Not RS.EOF Then
    > > Do Until RS.EOF
    > > RS.Delete
    > > RS.Update
    > > RS.MoveFirst
    > > Loop
    > > End If
    > >
    > > But when I use the same program to a MySQL databse it doesn't work.
    > > It will only delete the last record and then jump out as if it was
    > > ready.
    > >
    > > I am tearing my last hair on this one! - Can anybody tell what is
    > > wrong? / Rolf
    >
    > Don't take this the wrong way (you've obviously been lead down the wrong
    > path), but, this is horrid. Using a slow recordset loop to do the work of
    a
    > single sql statement?!?
    >
    > sql = "DELETE * FROM Table"
    > objConn.Execute sql,,adCmdText
    >
    > In ASP, recordsets should be used to retrieve read-only data sets for the
    > purpose of displaying them only. All data modifications should be done via
    > the appropriate sql data modification language (DML) elements: INSERT,
    > UPDATE and DELETE.
    >
    > I've never worked with MySQL, so I can't explain the strange behavior of
    > this recordset (you do not need the RS.Update line, BTW), it's probably
    due
    > to some quirk in the MySQL data provider that you are using.
    >
    > HTH,
    > Bob Barrows
    >
    >

    Rolf Rosenquist Guest

  4. #3

    Default Re: Can't delet recordset

    As I said, I don't know anything about MySQL. perhaps it wants:
    Delete From Table
    instead of
    Delete * From Table.

    That must be it: the "Delete * From... " syntax is JetSQL-specific.
    ANSI-standard SQL does not allow the *.

    I just tried to follow your link ... I get a server or DNS error. I find it
    difficult to believe the manual doesn't contain the proper syntax.

    Bob Barrows

    ..Rolf Rosenquist wrote:
    > Tried your suggestion (that I did not know about) but got this Error
    > message:
    >
    > Microsoft OLE DB Provider for ODBC Drivers fel '80040e14'
    >
    > [MySQL][ODBC 3.51 Driver][mysqld-4.0.14-nt]You have an error in your
    > SQL syntax. Check the manual that corresponds to your MySQL server
    > version for the right syntax to use near '* FROM Table' at line 1
    >
    > The reference manual at [url]http://www.mysql.com/doc/en/DELETE.html[/url] did
    > not reveal anything to me.
    >
    > / Rolf
    >
    >
    > "Bob Barrows" <reb_01501@yahoo.com> skrev i meddelandet
    > news:u8zHxMnXDHA.1680@tk2msftngp13.phx.gbl...
    >> Rolf Rosenquist wrote:
    >>> When in ASP and an Access database, I can delete all records in a
    >>> table with the code:
    >>>
    >>> sql = "SELECT * FROM Table "
    >>> Set RS = Server.CreateObject("ADODB.Recordset")
    >>> RS.Open sql, objConn, adLockPessimistic, adCmdTable
    >>> If Not RS.EOF Then
    >>> Do Until RS.EOF
    >>> RS.Delete
    >>> RS.Update
    >>> RS.MoveFirst
    >>> Loop
    >>> End If
    >>>
    >>> But when I use the same program to a MySQL databse it doesn't work.
    >>> It will only delete the last record and then jump out as if it was
    >>> ready.
    >>>
    >>> I am tearing my last hair on this one! - Can anybody tell what is
    >>> wrong? / Rolf
    >>
    >> Don't take this the wrong way (you've obviously been lead down the
    >> wrong path), but, this is horrid. Using a slow recordset loop to do
    >> the work of a single sql statement?!?
    >>
    >> sql = "DELETE * FROM Table"
    >> objConn.Execute sql,,adCmdText
    >>
    >> In ASP, recordsets should be used to retrieve read-only data sets
    >> for the purpose of displaying them only. All data modifications
    >> should be done via the appropriate sql data modification language
    >> (DML) elements: INSERT, UPDATE and DELETE.
    >>
    >> I've never worked with MySQL, so I can't explain the strange
    >> behavior of this recordset (you do not need the RS.Update line,
    >> BTW), it's probably due to some quirk in the MySQL data provider
    >> that you are using.
    >>
    >> HTH,
    >> Bob Barrows


    Bob Barrows Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139