more on database handling

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

  1. #1

    Default more on database handling

    Many thanks to all who have given so much advice already. This is much
    appreciated and I have now got my system sort of working. I am having more
    trouble with deleting a record from my database.

    I want to be able to select the event in a form and then collect this and
    use it in my delete statement as below.

    <%
    d = Request.Form("eventid")

    Set Catalog=Server.CreateObject("ADODB.Recordset")

    Catalog.open "DELETE * FROM tblbookings WHERE eventID = d", "DSN=calendar"


    Set Catalog=Nothing
    %>

    I realise that this is probably not the best method of doing this, but is
    there a way to do this. My delete statement doesn't seem to recognise the d
    as a variable.

    Geoff Wickens


    Geoff Wickens Guest

  2. Similar Questions and Discussions

    1. Client variable database repository exception handling
      We have recently had 2 incidents where client variable database storage appears to have failed in our clustered environment. We have 2 servers that...
    2. Handling multiple database server instances - failover
      Hi all, I have a oracle tnsentry like this. It has multiple failover instances for the oracle database. TESTSID = (DESCRIPTION =...
    3. NEWBIE HELP Import Data from flat-database to relational-database
      I want to import Data from a simple Database, which contains all Information in one big record into a relational Database and split up the big...
    4. Passing database info to page allow user input then pass into another database
      Hi I really am going crazy! I'm using VBScript, ASP, and SQL My page reminds me of a shopping cart but looking at shopping cart examples has not...
    5. Another user has modified the contents of this table or view; the database row you are modifying no longer exists in the database;
      Hi, I am testing a trigger that and I am getting this error message saying "Another user has modified the contents of this table or view; the...
  3. #2

    Default Re: more on database handling

    1. Don't create a recordset when deleting.
    2. Don't do "delete * from." Just do "delete from."
    3. Don't use a DSN unless you absolutely must.
    4. Your SQL string should look like:

    sSQL = "DELETE FROM [tblBookings] WHERE [EventID]=" & CStr(d)

    Ray at work

    "Geoff Wickens" <gwickens@hotmail.com> wrote in message
    news:nlp2b.5384$tS2.3514764@newsfep2-win.server.ntli.net...
    > Many thanks to all who have given so much advice already. This is much
    > appreciated and I have now got my system sort of working. I am having more
    > trouble with deleting a record from my database.
    >
    > I want to be able to select the event in a form and then collect this and
    > use it in my delete statement as below.
    >
    > <%
    > d = Request.Form("eventid")
    >
    > Set Catalog=Server.CreateObject("ADODB.Recordset")
    >
    > Catalog.open "DELETE * FROM tblbookings WHERE eventID = d", "DSN=calendar"
    >
    >
    > Set Catalog=Nothing
    > %>
    >
    > I realise that this is probably not the best method of doing this, but is
    > there a way to do this. My delete statement doesn't seem to recognise the
    d
    > as a variable.
    >
    > Geoff Wickens
    >
    >

    Ray at Guest

  4. #3

    Default Re: more on database handling

    Ray at <%=sLocation%> wrote:
    > 1. Don't create a recordset when deleting.
    > 2. Don't do "delete * from." Just do "delete from."
    With Jet, you need the *.

    Bob


    Bob Barrows Guest

  5. #4

    Default Re: more on database handling

    Really? I don't. ?

    Dim oADO
    Set oADO = CreateObject("ADODB.Connection")
    oADO.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test.mdb;"
    oADO.Execute "delete from table1"
    oADO.Close
    Set oADO = Nothing

    That works for me. ?

    Ray at work


    "Bob Barrows" <reb_01501@yahoo.com> wrote in message
    news:u2m8bz1aDHA.2412@TK2MSFTNGP10.phx.gbl...
    > Ray at <%=sLocation%> wrote:
    > > 1. Don't create a recordset when deleting.
    > > 2. Don't do "delete * from." Just do "delete from."
    >
    > With Jet, you need the *.
    >
    > Bob
    >
    >

    Ray at Guest

  6. #5

    Default Re: more on database handling

    Hmm - must have changed with Jet 4.0. I know I used to have to use it with
    A97 ...

    Bob
    Ray at <%=sLocation%> wrote:
    > Really? I don't. ?
    >
    > Dim oADO
    > Set oADO = CreateObject("ADODB.Connection")
    > oADO.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test.mdb;"
    > oADO.Execute "delete from table1"
    > oADO.Close
    > Set oADO = Nothing
    >
    > That works for me. ?
    >
    > Ray at work
    >
    >
    > "Bob Barrows" <reb_01501@yahoo.com> wrote in message
    > news:u2m8bz1aDHA.2412@TK2MSFTNGP10.phx.gbl...
    >> Ray at <%=sLocation%> wrote:
    >>> 1. Don't create a recordset when deleting.
    >>> 2. Don't do "delete * from." Just do "delete from."
    >>
    >> With Jet, you need the *.
    >>
    >> Bob

    Bob Barrows Guest

  7. #6

    Default Re: more on database handling

    So then it's something from before my time, I guess. I didn't even own a
    computer when Access 97 was out. :P

    Ray at work

    "Bob Barrows" <reb_01501@yahoo.com> wrote in message
    news:u8%231cK9aDHA.2296@TK2MSFTNGP09.phx.gbl...
    > Hmm - must have changed with Jet 4.0. I know I used to have to use it with
    > A97 ...
    >
    > Bob
    > Ray at <%=sLocation%> wrote:
    > > Really? I don't. ?
    > >
    > > Dim oADO
    > > Set oADO = CreateObject("ADODB.Connection")
    > > oADO.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\test.mdb;"
    > > oADO.Execute "delete from table1"
    > > oADO.Close
    > > Set oADO = Nothing
    > >
    > > That works for me. ?
    > >
    > > Ray at work
    > >
    > >
    > > "Bob Barrows" <reb_01501@yahoo.com> wrote in message
    > > news:u2m8bz1aDHA.2412@TK2MSFTNGP10.phx.gbl...
    > >> Ray at <%=sLocation%> wrote:
    > >>> 1. Don't create a recordset when deleting.
    > >>> 2. Don't do "delete * from." Just do "delete from."
    > >>
    > >> With Jet, you need the *.
    > >>
    > >> Bob
    >
    >

    Ray at 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