BOF or EOF is true?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Christo

    BOF or EOF is true?

    ADODB.Recordset error '800a0bcd'

    Either BOF or EOF is True, or the current record has been deleted.
    Requested operation requires a current record.

    /update.asp, line 21

    thats the error i am getting, my asp code is below....

    <%
    Dim dbCon
    Dim rsUpdate
    Dim strSQL
    Dim RecordNo

    RecordNo = CLng(Request.Qu eryString("id") )

    Set dbCon = Server.CreateOb ject("ADODB.Con nection")
    dbCon.Open "DSN=cb2cwh "

    Set rsUpdate = Server.CreateOb ject("ADODB.Rec ordset")

    strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo

    rsUpdate.Cursor Type = 2
    rsUpdate.LockTy pe = 3

    rsUpdate.Open strSQL, dbCon
    rsUpdate.Fields ("title") = Request.Form("t itle") '<<<<<<<<< LINE 21
    rsUpdate.Fields ("news") = Request.Form("n ews")
    rsUpdate.fields ("date") = Now()
    rsUpdate.Update
    rsUpdate.Close
    Set rsUpdate = Nothing
    Set dboCon = Nothing
    Response.Redire ct "deled_select.a sp"
    %>

    can anyone help me find out what the problem is here I am copying this
    script from a website its purely part of learning and i really want to
    know why it wont work on my IIS machine. the link to the website is
    below.



    I have had it working previously but it wont work now and there hasnt
    been much change.

  • Bob Barrows [MVP]

    #2
    Re: BOF or EOF is true?

    Christo wrote:
    ADODB.Recordset error '800a0bcd'
    >
    Either BOF or EOF is True, or the current record has been deleted.
    Requested operation requires a current record.
    >
    /update.asp, line 21
    >
    thats the error i am getting, my asp code is below....
    >
    <%
    Dim dbCon
    Dim rsUpdate
    Dim strSQL
    Dim RecordNo
    >
    RecordNo = CLng(Request.Qu eryString("id") )
    >
    Set dbCon = Server.CreateOb ject("ADODB.Con nection")
    dbCon.Open "DSN=cb2cwh "

    >
    Set rsUpdate = Server.CreateOb ject("ADODB.Rec ordset")
    >
    strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo
    response.write this strSQL variable so you can verify that it contains
    the sql statement you expect it to contain. It probably does not contain
    what you expect because it is not retrieving any records. Double-check
    it by running the sql statement in the query execution tool provided by
    whatever database you are using (it is always a good idea to provide the
    database type and version when asking database-related questions).

    <snip>
    >
    can anyone help me find out what the problem is here I am copying this
    script from a website its purely part of learning
    Well, you picked a bad one to copy. It's got several issues, the first
    of which I pointed out above. Other issues include:

    1. using selstar: http://www.aspfaq.com/show.asp?id=2096
    2. using a recordset to update data - in asp, recordsets should be used
    solely to retrieve readonly data for display purposes. SQL DML (Data
    Modification Language - UPDATE, INSERT and DELETE) statements should be
    used for data modification. In asp, it is critical to get in and out of
    the database as quickly as possible. Cursors (recordsets) are just too
    slow when it comes to data modification.
    3. Further points to consider:
    Your use of dynamic sql is leaving you vulnerable to hackers using sql
    injection:



    See here for a better, more secure way to execute your queries by using
    parameter markers:


    Personally, I prefer using stored procedures, or saved parameter queries
    as
    they are known in Access:

    Access:




    SQL Server:


    ..

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Comment

    • Mike Brind

      #3
      Re: BOF or EOF is true?

      "Christo" <cmw1985@google mail.comwrote in message
      news:1163425466 .332847.15810@e 3g2000cwe.googl egroups.com...
      ADODB.Recordset error '800a0bcd'
      >
      Either BOF or EOF is True, or the current record has been deleted.
      Requested operation requires a current record.
      >
      /update.asp, line 21
      >
      thats the error i am getting, my asp code is below....
      >
      <%
      Dim dbCon
      Dim rsUpdate
      Dim strSQL
      Dim RecordNo
      >
      RecordNo = CLng(Request.Qu eryString("id") )
      >
      Set dbCon = Server.CreateOb ject("ADODB.Con nection")
      dbCon.Open "DSN=cb2cwh "
      >
      Set rsUpdate = Server.CreateOb ject("ADODB.Rec ordset")
      >
      strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo
      >
      rsUpdate.Cursor Type = 2
      rsUpdate.LockTy pe = 3
      >
      rsUpdate.Open strSQL, dbCon
      rsUpdate.Fields ("title") = Request.Form("t itle") '<<<<<<<<< LINE 21
      rsUpdate.Fields ("news") = Request.Form("n ews")
      rsUpdate.fields ("date") = Now()
      rsUpdate.Update
      rsUpdate.Close
      Set rsUpdate = Nothing
      Set dboCon = Nothing
      Response.Redire ct "deled_select.a sp"
      %>
      >
      can anyone help me find out what the problem is here I am copying this
      script from a website its purely part of learning and i really want to
      know why it wont work on my IIS machine. the link to the website is
      below.
      >

      >
      I have had it working previously but it wont work now and there hasnt
      been much change.
      >
      BOF (beginning of file) is the region before any records. EOF (end of file)
      is the region after any records.
      ________
      BOF -- |_______|
      | |
      Records -- | |
      |_______|
      EOF -- |_______|


      The error message is saying that there are no records that belong to your
      select statement, in other words, that middle part is empty. After defining
      strSQL in your code, add this in:

      Response.Write strSQL
      Response.End

      This will write the value of strSQL to the browser. You may see that
      RecordNo now refers to a record that no longer exists, or it's blank.

      Stop using that tutorial. It's horrible. You should not be using a DSN to
      connect to a database these days (use the oledb driver instead), and
      creating a recordset to update records is awful too. This one is slightly
      better: http://w3schools.com/ado/ado_update.asp, although really for this
      type of operation, it's easier and safer to create a saved query in Access
      and use parameters to update or write records. (I'm assuming you are using
      Access, but if not, use stored procedures).

      For Access, the simplest way to do this is to open up Access, go the Query
      tab and create a new query in Design View. Close the Show Tables dialogue
      box and switch to SQL View. Using the example above, type in the SQL clause:

      UPDATE tblNews SET title = [p1], news = [p2], [date] = Date() WHERE id=[p3]

      [p1] and [p2] are parameter place holders. These are always in square
      brackets ( [ ] ), which tells Access to expect a value as a parameter.
      [date] is in square brackets because it is a reserved name in Access, and
      should never be used for column names. Call the column PostDate or
      something else. Then you an remove the square brackets from the field name.
      If you Run the query, Access will prompt you for input for each field. Enter
      data against each field to test that the query is working. As for debugging,
      you've just done it. Save the query as something meaningful - qryUpdateNews
      for example.

      In your ASP code, you will still need to validate the inputs, such as email
      addresses for structure, end dates are after start dates, values are
      actually being passed etc, but you do not need to check for quote marks or
      delimit the inputs in any way. Since the query was created within Access,
      the database already knows what data types to expect.

      p1 = Request.Form("t itle") 'no need to check for apostophes in e.g. King's
      Ransom Paid
      p2 = Request.Form("n ews")
      p3 = Request.Form("i d")


      Then, assuming conn is an opened and valid connection object, use the query
      name as a method against conn, with a comma-separated list of parameters:

      conn.qryUpdaten ews p1,p2, p3
      conn.close : set conn = nothing

      --
      Mike Brind




      Comment

      • Firas S Assaad

        #4
        Re: BOF or EOF is true?

        If that didnt help
        send me your database, and i will check it for you. Then i will fully
        explain the problem for you

        Btw, excuse me guys, i had posted this reply, not based on anybody'd
        post, so if it was duplicated please excuse, cause im in a hurry right
        now.



        Best Regards
        Firas S Assaad


        Mike Brind wrote:
        "Christo" <cmw1985@google mail.comwrote in message
        news:1163425466 .332847.15810@e 3g2000cwe.googl egroups.com...
        ADODB.Recordset error '800a0bcd'

        Either BOF or EOF is True, or the current record has been deleted.
        Requested operation requires a current record.

        /update.asp, line 21

        thats the error i am getting, my asp code is below....

        <%
        Dim dbCon
        Dim rsUpdate
        Dim strSQL
        Dim RecordNo

        RecordNo = CLng(Request.Qu eryString("id") )

        Set dbCon = Server.CreateOb ject("ADODB.Con nection")
        dbCon.Open "DSN=cb2cwh "

        Set rsUpdate = Server.CreateOb ject("ADODB.Rec ordset")

        strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo

        rsUpdate.Cursor Type = 2
        rsUpdate.LockTy pe = 3

        rsUpdate.Open strSQL, dbCon
        rsUpdate.Fields ("title") = Request.Form("t itle") '<<<<<<<<< LINE 21
        rsUpdate.Fields ("news") = Request.Form("n ews")
        rsUpdate.fields ("date") = Now()
        rsUpdate.Update
        rsUpdate.Close
        Set rsUpdate = Nothing
        Set dboCon = Nothing
        Response.Redire ct "deled_select.a sp"
        %>

        can anyone help me find out what the problem is here I am copying this
        script from a website its purely part of learning and i really want to
        know why it wont work on my IIS machine. the link to the website is
        below.



        I have had it working previously but it wont work now and there hasnt
        been much change.
        >
        BOF (beginning of file) is the region before any records. EOF (end of file)
        is the region after any records.
        ________
        BOF -- |_______|
        | |
        Records -- | |
        |_______|
        EOF -- |_______|
        >
        >
        The error message is saying that there are no records that belong to your
        select statement, in other words, that middle part is empty. After defining
        strSQL in your code, add this in:
        >
        Response.Write strSQL
        Response.End
        >
        This will write the value of strSQL to the browser. You may see that
        RecordNo now refers to a record that no longer exists, or it's blank.
        >
        Stop using that tutorial. It's horrible. You should not be using a DSN to
        connect to a database these days (use the oledb driver instead), and
        creating a recordset to update records is awful too. This one is slightly
        better: http://w3schools.com/ado/ado_update.asp, although really for this
        type of operation, it's easier and safer to create a saved query in Access
        and use parameters to update or write records. (I'm assuming you are using
        Access, but if not, use stored procedures).
        >
        For Access, the simplest way to do this is to open up Access, go the Query
        tab and create a new query in Design View. Close the Show Tables dialogue
        box and switch to SQL View. Using the example above, type in the SQL clause:
        >
        UPDATE tblNews SET title = [p1], news = [p2], [date] = Date() WHERE id=[p3]
        >
        [p1] and [p2] are parameter place holders. These are always in square
        brackets ( [ ] ), which tells Access to expect a value as a parameter.
        [date] is in square brackets because it is a reserved name in Access, and
        should never be used for column names. Call the column PostDate or
        something else. Then you an remove the square brackets from the field name.
        If you Run the query, Access will prompt you for input for each field. Enter
        data against each field to test that the query is working. As for debugging,
        you've just done it. Save the query as something meaningful - qryUpdateNews
        for example.
        >
        In your ASP code, you will still need to validate the inputs, such as email
        addresses for structure, end dates are after start dates, values are
        actually being passed etc, but you do not need to check for quote marks or
        delimit the inputs in any way. Since the query was created within Access,
        the database already knows what data types to expect.
        >
        p1 = Request.Form("t itle") 'no need to check for apostophes in e.g. King's
        Ransom Paid
        p2 = Request.Form("n ews")
        p3 = Request.Form("i d")
        >
        >
        Then, assuming conn is an opened and valid connection object, use the query
        name as a method against conn, with a comma-separated list of parameters:
        >
        conn.qryUpdaten ews p1,p2, p3
        conn.close : set conn = nothing
        >
        --
        Mike Brind

        Comment

        • Mike Brind

          #5
          Re: BOF or EOF is true?

          You'll be able to explain it just by looking at the database? Wow!

          --
          Mike Brind


          "Firas S Assaad" <firas489@gmail .comwrote in message
          news:1163508511 .945327.51960@k 70g2000cwa.goog legroups.com...
          If that didnt help
          send me your database, and i will check it for you. Then i will fully
          explain the problem for you
          >
          Btw, excuse me guys, i had posted this reply, not based on anybody'd
          post, so if it was duplicated please excuse, cause im in a hurry right
          now.
          >
          >
          >
          Best Regards
          Firas S Assaad
          >
          >
          Mike Brind wrote:
          >"Christo" <cmw1985@google mail.comwrote in message
          >news:116342546 6.332847.15810@ e3g2000cwe.goog legroups.com...
          ADODB.Recordset error '800a0bcd'
          >
          Either BOF or EOF is True, or the current record has been deleted.
          Requested operation requires a current record.
          >
          /update.asp, line 21
          >
          thats the error i am getting, my asp code is below....
          >
          <%
          Dim dbCon
          Dim rsUpdate
          Dim strSQL
          Dim RecordNo
          >
          RecordNo = CLng(Request.Qu eryString("id") )
          >
          Set dbCon = Server.CreateOb ject("ADODB.Con nection")
          dbCon.Open "DSN=cb2cwh "
          >
          Set rsUpdate = Server.CreateOb ject("ADODB.Rec ordset")
          >
          strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo
          >
          rsUpdate.Cursor Type = 2
          rsUpdate.LockTy pe = 3
          >
          rsUpdate.Open strSQL, dbCon
          rsUpdate.Fields ("title") = Request.Form("t itle") '<<<<<<<<< LINE 21
          rsUpdate.Fields ("news") = Request.Form("n ews")
          rsUpdate.fields ("date") = Now()
          rsUpdate.Update
          rsUpdate.Close
          Set rsUpdate = Nothing
          Set dboCon = Nothing
          Response.Redire ct "deled_select.a sp"
          %>
          >
          can anyone help me find out what the problem is here I am copying this
          script from a website its purely part of learning and i really want to
          know why it wont work on my IIS machine. the link to the website is
          below.
          >

          >
          I have had it working previously but it wont work now and there hasnt
          been much change.
          >
          >>
          >BOF (beginning of file) is the region before any records. EOF (end of
          >file)
          >is the region after any records.
          > ________
          >BOF -- |_______|
          > | |
          >Records -- | |
          > |_______|
          >EOF -- |_______|
          >>
          >>
          >The error message is saying that there are no records that belong to your
          >select statement, in other words, that middle part is empty. After
          >defining
          >strSQL in your code, add this in:
          >>
          >Response.Wri te strSQL
          >Response.End
          >>
          >This will write the value of strSQL to the browser. You may see that
          >RecordNo now refers to a record that no longer exists, or it's blank.
          >>
          >Stop using that tutorial. It's horrible. You should not be using a DSN
          >to
          >connect to a database these days (use the oledb driver instead), and
          >creating a recordset to update records is awful too. This one is
          >slightly
          >better: http://w3schools.com/ado/ado_update.asp, although really for this
          >type of operation, it's easier and safer to create a saved query in
          >Access
          >and use parameters to update or write records. (I'm assuming you are
          >using
          >Access, but if not, use stored procedures).
          >>
          >For Access, the simplest way to do this is to open up Access, go the
          >Query
          >tab and create a new query in Design View. Close the Show Tables dialogue
          >box and switch to SQL View. Using the example above, type in the SQL
          >clause:
          >>
          >UPDATE tblNews SET title = [p1], news = [p2], [date] = Date() WHERE
          >id=[p3]
          >>
          >[p1] and [p2] are parameter place holders. These are always in square
          >brackets ( [ ] ), which tells Access to expect a value as a parameter.
          >[date] is in square brackets because it is a reserved name in Access, and
          >should never be used for column names. Call the column PostDate or
          >something else. Then you an remove the square brackets from the field
          >name.
          >If you Run the query, Access will prompt you for input for each field.
          >Enter
          >data against each field to test that the query is working. As for
          >debugging,
          >you've just done it. Save the query as something meaningful -
          >qryUpdateNew s
          >for example.
          >>
          >In your ASP code, you will still need to validate the inputs, such as
          >email
          >addresses for structure, end dates are after start dates, values are
          >actually being passed etc, but you do not need to check for quote marks
          >or
          >delimit the inputs in any way. Since the query was created within Access,
          >the database already knows what data types to expect.
          >>
          >p1 = Request.Form("t itle") 'no need to check for apostophes in e.g.
          >King's
          >Ransom Paid
          >p2 = Request.Form("n ews")
          >p3 = Request.Form("i d")
          >>
          >>
          >Then, assuming conn is an opened and valid connection object, use the
          >query
          >name as a method against conn, with a comma-separated list of parameters:
          >>
          >conn.qryUpdate news p1,p2, p3
          >conn.close : set conn = nothing
          >>
          >--
          >Mike Brind
          >

          Comment

          • Firas S Assaad

            #6
            Re: BOF or EOF is true?

            I dont think is need a "high" skill just to know that you can run the
            SQL statement in the database and figure out the problem.
            Take my advice my friend and "Think out of the box" for a second. Dont
            be so routine.


            Best Regards
            Mike Brind wrote:
            You'll be able to explain it just by looking at the database? Wow!
            >
            --
            Mike Brind
            >
            >
            "Firas S Assaad" <firas489@gmail .comwrote in message
            news:1163508511 .945327.51960@k 70g2000cwa.goog legroups.com...
            If that didnt help
            send me your database, and i will check it for you. Then i will fully
            explain the problem for you

            Btw, excuse me guys, i had posted this reply, not based on anybody'd
            post, so if it was duplicated please excuse, cause im in a hurry right
            now.



            Best Regards
            Firas S Assaad


            Mike Brind wrote:
            "Christo" <cmw1985@google mail.comwrote in message
            news:1163425466 .332847.15810@e 3g2000cwe.googl egroups.com...
            ADODB.Recordset error '800a0bcd'

            Either BOF or EOF is True, or the current record has been deleted.
            Requested operation requires a current record.

            /update.asp, line 21

            thats the error i am getting, my asp code is below....

            <%
            Dim dbCon
            Dim rsUpdate
            Dim strSQL
            Dim RecordNo

            RecordNo = CLng(Request.Qu eryString("id") )

            Set dbCon = Server.CreateOb ject("ADODB.Con nection")
            dbCon.Open "DSN=cb2cwh "

            Set rsUpdate = Server.CreateOb ject("ADODB.Rec ordset")

            strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo

            rsUpdate.Cursor Type = 2
            rsUpdate.LockTy pe = 3

            rsUpdate.Open strSQL, dbCon
            rsUpdate.Fields ("title") = Request.Form("t itle") '<<<<<<<<< LINE 21
            rsUpdate.Fields ("news") = Request.Form("n ews")
            rsUpdate.fields ("date") = Now()
            rsUpdate.Update
            rsUpdate.Close
            Set rsUpdate = Nothing
            Set dboCon = Nothing
            Response.Redire ct "deled_select.a sp"
            %>

            can anyone help me find out what the problem is here I am copying this
            script from a website its purely part of learning and i really want to
            know why it wont work on my IIS machine. the link to the website is
            below.



            I have had it working previously but it wont work now and there hasnt
            been much change.

            >
            BOF (beginning of file) is the region before any records. EOF (end of
            file)
            is the region after any records.
            ________
            BOF -- |_______|
            | |
            Records -- | |
            |_______|
            EOF -- |_______|
            >
            >
            The error message is saying that there are no records that belong to your
            select statement, in other words, that middle part is empty. After
            defining
            strSQL in your code, add this in:
            >
            Response.Write strSQL
            Response.End
            >
            This will write the value of strSQL to the browser. You may see that
            RecordNo now refers to a record that no longer exists, or it's blank.
            >
            Stop using that tutorial. It's horrible. You should not be using a DSN
            to
            connect to a database these days (use the oledb driver instead), and
            creating a recordset to update records is awful too. This one is
            slightly
            better: http://w3schools.com/ado/ado_update.asp, although really for this
            type of operation, it's easier and safer to create a saved query in
            Access
            and use parameters to update or write records. (I'm assuming you are
            using
            Access, but if not, use stored procedures).
            >
            For Access, the simplest way to do this is to open up Access, go the
            Query
            tab and create a new query in Design View. Close the Show Tables dialogue
            box and switch to SQL View. Using the example above, type in the SQL
            clause:
            >
            UPDATE tblNews SET title = [p1], news = [p2], [date] = Date() WHERE
            id=[p3]
            >
            [p1] and [p2] are parameter place holders. These are always in square
            brackets ( [ ] ), which tells Access to expect a value as a parameter.
            [date] is in square brackets because it is a reserved name in Access, and
            should never be used for column names. Call the column PostDate or
            something else. Then you an remove the square brackets from the field
            name.
            If you Run the query, Access will prompt you for input for each field.
            Enter
            data against each field to test that the query is working. As for
            debugging,
            you've just done it. Save the query as something meaningful -
            qryUpdateNews
            for example.
            >
            In your ASP code, you will still need to validate the inputs, such as
            email
            addresses for structure, end dates are after start dates, values are
            actually being passed etc, but you do not need to check for quote marks
            or
            delimit the inputs in any way. Since the query was created within Access,
            the database already knows what data types to expect.
            >
            p1 = Request.Form("t itle") 'no need to check for apostophes in e.g.
            King's
            Ransom Paid
            p2 = Request.Form("n ews")
            p3 = Request.Form("i d")
            >
            >
            Then, assuming conn is an opened and valid connection object, use the
            query
            name as a method against conn, with a comma-separated list of parameters:
            >
            conn.qryUpdaten ews p1,p2, p3
            conn.close : set conn = nothing
            >
            --
            Mike Brind

            Comment

            • Christo

              #7
              Re: BOF or EOF is true?

              cheers for all your help, after reading your advice and asfter getting
              advice from other people around me I have decided to redesign my
              database in mysql, and am probably going to go over to php, I know i
              shouldn't be mentioning this here in an ASP group but just incase you
              guys thought I was being ignorant by not replying, I appreciate your
              help, unfortunately Since then i have come accorss some deeper problems
              with my IIS setup on my machine, so again moving over to apache.

              Thanks for your help all

              :-)

              Chris

              Firas S Assaad wrote:
              I dont think is need a "high" skill just to know that you can run the
              SQL statement in the database and figure out the problem.
              Take my advice my friend and "Think out of the box" for a second. Dont
              be so routine.
              >
              >
              Best Regards
              Mike Brind wrote:
              You'll be able to explain it just by looking at the database? Wow!

              --
              Mike Brind


              "Firas S Assaad" <firas489@gmail .comwrote in message
              news:1163508511 .945327.51960@k 70g2000cwa.goog legroups.com...
              If that didnt help
              send me your database, and i will check it for you. Then i will fully
              explain the problem for you
              >
              Btw, excuse me guys, i had posted this reply, not based on anybody'd
              post, so if it was duplicated please excuse, cause im in a hurry right
              now.
              >
              >
              >
              Best Regards
              Firas S Assaad
              >
              >
              Mike Brind wrote:
              >"Christo" <cmw1985@google mail.comwrote in message
              >news:116342546 6.332847.15810@ e3g2000cwe.goog legroups.com...
              ADODB.Recordset error '800a0bcd'
              >
              Either BOF or EOF is True, or the current record has been deleted.
              Requested operation requires a current record.
              >
              /update.asp, line 21
              >
              thats the error i am getting, my asp code is below....
              >
              <%
              Dim dbCon
              Dim rsUpdate
              Dim strSQL
              Dim RecordNo
              >
              RecordNo = CLng(Request.Qu eryString("id") )
              >
              Set dbCon = Server.CreateOb ject("ADODB.Con nection")
              dbCon.Open "DSN=cb2cwh "
              >
              Set rsUpdate = Server.CreateOb ject("ADODB.Rec ordset")
              >
              strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo
              >
              rsUpdate.Cursor Type = 2
              rsUpdate.LockTy pe = 3
              >
              rsUpdate.Open strSQL, dbCon
              rsUpdate.Fields ("title") = Request.Form("t itle") '<<<<<<<<< LINE 21
              rsUpdate.Fields ("news") = Request.Form("n ews")
              rsUpdate.fields ("date") = Now()
              rsUpdate.Update
              rsUpdate.Close
              Set rsUpdate = Nothing
              Set dboCon = Nothing
              Response.Redire ct "deled_select.a sp"
              %>
              >
              can anyone help me find out what the problem is here I am copying this
              script from a website its purely part of learning and i really want to
              know why it wont work on my IIS machine. the link to the website is
              below.
              >

              >
              I have had it working previously but it wont work now and there hasnt
              been much change.
              >
              >>
              >BOF (beginning of file) is the region before any records. EOF (end of
              >file)
              >is the region after any records.
              > ________
              >BOF -- |_______|
              > | |
              >Records -- | |
              > |_______|
              >EOF -- |_______|
              >>
              >>
              >The error message is saying that there are no records that belong to your
              >select statement, in other words, that middle part is empty. After
              >defining
              >strSQL in your code, add this in:
              >>
              >Response.Wri te strSQL
              >Response.End
              >>
              >This will write the value of strSQL to the browser. You may see that
              >RecordNo now refers to a record that no longer exists, or it's blank.
              >>
              >Stop using that tutorial. It's horrible. You should not be using a DSN
              >to
              >connect to a database these days (use the oledb driver instead), and
              >creating a recordset to update records is awful too. This one is
              >slightly
              >better: http://w3schools.com/ado/ado_update.asp, although really for this
              >type of operation, it's easier and safer to create a saved query in
              >Access
              >and use parameters to update or write records. (I'm assuming you are
              >using
              >Access, but if not, use stored procedures).
              >>
              >For Access, the simplest way to do this is to open up Access, go the
              >Query
              >tab and create a new query in Design View. Close the Show Tables dialogue
              >box and switch to SQL View. Using the example above, type in the SQL
              >clause:
              >>
              >UPDATE tblNews SET title = [p1], news = [p2], [date] = Date() WHERE
              >id=[p3]
              >>
              >[p1] and [p2] are parameter place holders. These are always in square
              >brackets ( [ ] ), which tells Access to expect a value as a parameter.
              >[date] is in square brackets because it is a reserved name in Access, and
              >should never be used for column names. Call the column PostDate or
              >something else. Then you an remove the square brackets from the field
              >name.
              >If you Run the query, Access will prompt you for input for each field.
              >Enter
              >data against each field to test that the query is working. As for
              >debugging,
              >you've just done it. Save the query as something meaningful -
              >qryUpdateNew s
              >for example.
              >>
              >In your ASP code, you will still need to validate the inputs, such as
              >email
              >addresses for structure, end dates are after start dates, values are
              >actually being passed etc, but you do not need to check for quote marks
              >or
              >delimit the inputs in any way. Since the query was created within Access,
              >the database already knows what data types to expect.
              >>
              >p1 = Request.Form("t itle") 'no need to check for apostophes in e.g.
              >King's
              >Ransom Paid
              >p2 = Request.Form("n ews")
              >p3 = Request.Form("i d")
              >>
              >>
              >Then, assuming conn is an opened and valid connection object, use the
              >query
              >name as a method against conn, with a comma-separated list of parameters:
              >>
              >conn.qryUpdate news p1,p2, p3
              >conn.close : set conn = nothing
              >>
              >--
              >Mike Brind
              >

              Comment

              • Mike Brind

                #8
                Re: BOF or EOF is true?

                Think out of the box? For a BOF or EOF?? Gee - thanks for the advice.
                I'll bear it in mind.

                "Firas S Assaad" <firas489@gmail .comwrote in message
                news:1163549355 .271419.286120@ m73g2000cwd.goo glegroups.com.. .
                >I dont think is need a "high" skill just to know that you can run the
                SQL statement in the database and figure out the problem.
                Take my advice my friend and "Think out of the box" for a second. Dont
                be so routine.
                >
                >
                Best Regards
                Mike Brind wrote:
                >You'll be able to explain it just by looking at the database? Wow!
                >>
                >--
                >Mike Brind
                >>
                >>
                >"Firas S Assaad" <firas489@gmail .comwrote in message
                >news:116350851 1.945327.51960@ k70g2000cwa.goo glegroups.com.. .
                If that didnt help
                send me your database, and i will check it for you. Then i will fully
                explain the problem for you
                >
                Btw, excuse me guys, i had posted this reply, not based on anybody'd
                post, so if it was duplicated please excuse, cause im in a hurry right
                now.
                >
                >
                >
                Best Regards
                Firas S Assaad
                >
                >
                Mike Brind wrote:
                >"Christo" <cmw1985@google mail.comwrote in message
                >news:116342546 6.332847.15810@ e3g2000cwe.goog legroups.com...
                ADODB.Recordset error '800a0bcd'
                >
                Either BOF or EOF is True, or the current record has been deleted.
                Requested operation requires a current record.
                >
                /update.asp, line 21
                >
                thats the error i am getting, my asp code is below....
                >
                <%
                Dim dbCon
                Dim rsUpdate
                Dim strSQL
                Dim RecordNo
                >
                RecordNo = CLng(Request.Qu eryString("id") )
                >
                Set dbCon = Server.CreateOb ject("ADODB.Con nection")
                dbCon.Open "DSN=cb2cwh "
                >
                Set rsUpdate = Server.CreateOb ject("ADODB.Rec ordset")
                >
                strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo
                >
                rsUpdate.Cursor Type = 2
                rsUpdate.LockTy pe = 3
                >
                rsUpdate.Open strSQL, dbCon
                rsUpdate.Fields ("title") = Request.Form("t itle") '<<<<<<<<< LINE 21
                rsUpdate.Fields ("news") = Request.Form("n ews")
                rsUpdate.fields ("date") = Now()
                rsUpdate.Update
                rsUpdate.Close
                Set rsUpdate = Nothing
                Set dboCon = Nothing
                Response.Redire ct "deled_select.a sp"
                %>
                >
                can anyone help me find out what the problem is here I am copying
                this
                script from a website its purely part of learning and i really want
                to
                know why it wont work on my IIS machine. the link to the website is
                below.
                >

                >
                I have had it working previously but it wont work now and there
                hasnt
                been much change.
                >
                >>
                >BOF (beginning of file) is the region before any records. EOF (end of
                >file)
                >is the region after any records.
                > ________
                >BOF -- |_______|
                > | |
                >Records -- | |
                > |_______|
                >EOF -- |_______|
                >>
                >>
                >The error message is saying that there are no records that belong to
                >your
                >select statement, in other words, that middle part is empty. After
                >defining
                >strSQL in your code, add this in:
                >>
                >Response.Wri te strSQL
                >Response.End
                >>
                >This will write the value of strSQL to the browser. You may see that
                >RecordNo now refers to a record that no longer exists, or it's blank.
                >>
                >Stop using that tutorial. It's horrible. You should not be using a
                >DSN
                >to
                >connect to a database these days (use the oledb driver instead), and
                >creating a recordset to update records is awful too. This one is
                >slightly
                >better: http://w3schools.com/ado/ado_update.asp, although really for
                >this
                >type of operation, it's easier and safer to create a saved query in
                >Access
                >and use parameters to update or write records. (I'm assuming you are
                >using
                >Access, but if not, use stored procedures).
                >>
                >For Access, the simplest way to do this is to open up Access, go the
                >Query
                >tab and create a new query in Design View. Close the Show Tables
                >dialogue
                >box and switch to SQL View. Using the example above, type in the SQL
                >clause:
                >>
                >UPDATE tblNews SET title = [p1], news = [p2], [date] = Date() WHERE
                >id=[p3]
                >>
                >[p1] and [p2] are parameter place holders. These are always in square
                >brackets ( [ ] ), which tells Access to expect a value as a parameter.
                >[date] is in square brackets because it is a reserved name in Access,
                >and
                >should never be used for column names. Call the column PostDate or
                >something else. Then you an remove the square brackets from the field
                >name.
                >If you Run the query, Access will prompt you for input for each field.
                >Enter
                >data against each field to test that the query is working. As for
                >debugging,
                >you've just done it. Save the query as something meaningful -
                >qryUpdateNew s
                >for example.
                >>
                >In your ASP code, you will still need to validate the inputs, such as
                >email
                >addresses for structure, end dates are after start dates, values are
                >actually being passed etc, but you do not need to check for quote
                >marks
                >or
                >delimit the inputs in any way. Since the query was created within
                >Access,
                >the database already knows what data types to expect.
                >>
                >p1 = Request.Form("t itle") 'no need to check for apostophes in e.g.
                >King's
                >Ransom Paid
                >p2 = Request.Form("n ews")
                >p3 = Request.Form("i d")
                >>
                >>
                >Then, assuming conn is an opened and valid connection object, use the
                >query
                >name as a method against conn, with a comma-separated list of
                >parameters:
                >>
                >conn.qryUpdate news p1,p2, p3
                >conn.close : set conn = nothing
                >>
                >--
                >Mike Brind
                >
                >

                Comment

                Working...