BOF or EOF is true?

Discussion in 'ASP General' started by Christo, Nov 13, 2006.

  1. Christo

    Christo Guest

    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.QueryString("id"))

    Set dbCon = Server.CreateObject("ADODB.Connection")
    dbCon.Open "DSN=cb2cwh"

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

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

    rsUpdate.CursorType = 2
    rsUpdate.LockType = 3

    rsUpdate.Open strSQL, dbCon
    rsUpdate.Fields("title") = Request.Form("title") '<<<<<<<<< LINE 21
    rsUpdate.Fields("news") = Request.Form("news")
    rsUpdate.fields("date") = Now()
    rsUpdate.Update
    rsUpdate.Close
    Set rsUpdate = Nothing
    Set dboCon = Nothing
    Response.Redirect "deled_select.asp"
    %>

    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.

    http://www.webwizguide.info/asp/tutorials/updating_data_from_database.asp

    I have had it working previously but it wont work now and there hasnt
    been much change.
     
    Christo, Nov 13, 2006
    #1
    1. Advertising

  2. 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.QueryString("id"))
    >
    > Set dbCon = Server.CreateObject("ADODB.Connection")
    > dbCon.Open "DSN=cb2cwh"


    http://www.aspfaq.com/show.asp?id=2126

    >
    > Set rsUpdate = Server.CreateObject("ADODB.Recordset")
    >
    > 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:
    http://mvp.unixwiz.net/techtips/sql-injection.html
    http://www.sqlsecurity.com/DesktopDefault.aspx?tabid=23

    See here for a better, more secure way to execute your queries by using
    parameter markers:
    http://groups-beta.google.com/group/microsoft.public.inetserver.asp.db/msg/72e36562fee7804e

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

    Access:
    http://www.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=

    http://groups.google.com/groups?hl=...=1&selm=

    SQL Server:
    http://tinyurl.com/jyy0

    ..

    --
    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.
     
    Bob Barrows [MVP], Nov 13, 2006
    #2
    1. Advertising

  3. Christo

    Mike Brind Guest

    "Christo" <> wrote in message
    news:...
    > 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.QueryString("id"))
    >
    > Set dbCon = Server.CreateObject("ADODB.Connection")
    > dbCon.Open "DSN=cb2cwh"
    >
    > Set rsUpdate = Server.CreateObject("ADODB.Recordset")
    >
    > strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo
    >
    > rsUpdate.CursorType = 2
    > rsUpdate.LockType = 3
    >
    > rsUpdate.Open strSQL, dbCon
    > rsUpdate.Fields("title") = Request.Form("title") '<<<<<<<<< LINE 21
    > rsUpdate.Fields("news") = Request.Form("news")
    > rsUpdate.fields("date") = Now()
    > rsUpdate.Update
    > rsUpdate.Close
    > Set rsUpdate = Nothing
    > Set dboCon = Nothing
    > Response.Redirect "deled_select.asp"
    > %>
    >
    > 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.
    >
    > http://www.webwizguide.info/asp/tutorials/updating_data_from_database.asp
    >
    > 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("title") 'no need to check for apostophes in e.g. King's
    Ransom Paid
    p2 = Request.Form("news")
    p3 = Request.Form("id")


    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.qryUpdatenews p1,p2, p3
    conn.close : set conn = nothing

    --
    Mike Brind
     
    Mike Brind, Nov 13, 2006
    #3
  4. 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" <> wrote in message
    > news:...
    > > 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.QueryString("id"))
    > >
    > > Set dbCon = Server.CreateObject("ADODB.Connection")
    > > dbCon.Open "DSN=cb2cwh"
    > >
    > > Set rsUpdate = Server.CreateObject("ADODB.Recordset")
    > >
    > > strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo
    > >
    > > rsUpdate.CursorType = 2
    > > rsUpdate.LockType = 3
    > >
    > > rsUpdate.Open strSQL, dbCon
    > > rsUpdate.Fields("title") = Request.Form("title") '<<<<<<<<< LINE 21
    > > rsUpdate.Fields("news") = Request.Form("news")
    > > rsUpdate.fields("date") = Now()
    > > rsUpdate.Update
    > > rsUpdate.Close
    > > Set rsUpdate = Nothing
    > > Set dboCon = Nothing
    > > Response.Redirect "deled_select.asp"
    > > %>
    > >
    > > 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.
    > >
    > > http://www.webwizguide.info/asp/tutorials/updating_data_from_database.asp
    > >
    > > 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("title") 'no need to check for apostophes in e.g. King's
    > Ransom Paid
    > p2 = Request.Form("news")
    > p3 = Request.Form("id")
    >
    >
    > 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.qryUpdatenews p1,p2, p3
    > conn.close : set conn = nothing
    >
    > --
    > Mike Brind
     
    Firas S Assaad, Nov 14, 2006
    #4
  5. Christo

    Mike Brind Guest

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

    --
    Mike Brind


    "Firas S Assaad" <> wrote in message
    news:...
    > 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" <> wrote in message
    >> news:...
    >> > 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.QueryString("id"))
    >> >
    >> > Set dbCon = Server.CreateObject("ADODB.Connection")
    >> > dbCon.Open "DSN=cb2cwh"
    >> >
    >> > Set rsUpdate = Server.CreateObject("ADODB.Recordset")
    >> >
    >> > strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo
    >> >
    >> > rsUpdate.CursorType = 2
    >> > rsUpdate.LockType = 3
    >> >
    >> > rsUpdate.Open strSQL, dbCon
    >> > rsUpdate.Fields("title") = Request.Form("title") '<<<<<<<<< LINE 21
    >> > rsUpdate.Fields("news") = Request.Form("news")
    >> > rsUpdate.fields("date") = Now()
    >> > rsUpdate.Update
    >> > rsUpdate.Close
    >> > Set rsUpdate = Nothing
    >> > Set dboCon = Nothing
    >> > Response.Redirect "deled_select.asp"
    >> > %>
    >> >
    >> > 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.
    >> >
    >> > http://www.webwizguide.info/asp/tutorials/updating_data_from_database.asp
    >> >
    >> > 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("title") 'no need to check for apostophes in e.g.
    >> King's
    >> Ransom Paid
    >> p2 = Request.Form("news")
    >> p3 = Request.Form("id")
    >>
    >>
    >> 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.qryUpdatenews p1,p2, p3
    >> conn.close : set conn = nothing
    >>
    >> --
    >> Mike Brind

    >
     
    Mike Brind, Nov 14, 2006
    #5
  6. 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" <> wrote in message
    > news:...
    > > 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" <> wrote in message
    > >> news:...
    > >> > 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.QueryString("id"))
    > >> >
    > >> > Set dbCon = Server.CreateObject("ADODB.Connection")
    > >> > dbCon.Open "DSN=cb2cwh"
    > >> >
    > >> > Set rsUpdate = Server.CreateObject("ADODB.Recordset")
    > >> >
    > >> > strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo
    > >> >
    > >> > rsUpdate.CursorType = 2
    > >> > rsUpdate.LockType = 3
    > >> >
    > >> > rsUpdate.Open strSQL, dbCon
    > >> > rsUpdate.Fields("title") = Request.Form("title") '<<<<<<<<< LINE 21
    > >> > rsUpdate.Fields("news") = Request.Form("news")
    > >> > rsUpdate.fields("date") = Now()
    > >> > rsUpdate.Update
    > >> > rsUpdate.Close
    > >> > Set rsUpdate = Nothing
    > >> > Set dboCon = Nothing
    > >> > Response.Redirect "deled_select.asp"
    > >> > %>
    > >> >
    > >> > 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.
    > >> >
    > >> > http://www.webwizguide.info/asp/tutorials/updating_data_from_database.asp
    > >> >
    > >> > 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("title") 'no need to check for apostophes in e.g.
    > >> King's
    > >> Ransom Paid
    > >> p2 = Request.Form("news")
    > >> p3 = Request.Form("id")
    > >>
    > >>
    > >> 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.qryUpdatenews p1,p2, p3
    > >> conn.close : set conn = nothing
    > >>
    > >> --
    > >> Mike Brind

    > >
     
    Firas S Assaad, Nov 15, 2006
    #6
  7. Christo

    Christo Guest

    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" <> wrote in message
    > > news:...
    > > > 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" <> wrote in message
    > > >> news:...
    > > >> > 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.QueryString("id"))
    > > >> >
    > > >> > Set dbCon = Server.CreateObject("ADODB.Connection")
    > > >> > dbCon.Open "DSN=cb2cwh"
    > > >> >
    > > >> > Set rsUpdate = Server.CreateObject("ADODB.Recordset")
    > > >> >
    > > >> > strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo
    > > >> >
    > > >> > rsUpdate.CursorType = 2
    > > >> > rsUpdate.LockType = 3
    > > >> >
    > > >> > rsUpdate.Open strSQL, dbCon
    > > >> > rsUpdate.Fields("title") = Request.Form("title") '<<<<<<<<< LINE 21
    > > >> > rsUpdate.Fields("news") = Request.Form("news")
    > > >> > rsUpdate.fields("date") = Now()
    > > >> > rsUpdate.Update
    > > >> > rsUpdate.Close
    > > >> > Set rsUpdate = Nothing
    > > >> > Set dboCon = Nothing
    > > >> > Response.Redirect "deled_select.asp"
    > > >> > %>
    > > >> >
    > > >> > 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.
    > > >> >
    > > >> > http://www.webwizguide.info/asp/tutorials/updating_data_from_database.asp
    > > >> >
    > > >> > 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("title") 'no need to check for apostophes in e.g.
    > > >> King's
    > > >> Ransom Paid
    > > >> p2 = Request.Form("news")
    > > >> p3 = Request.Form("id")
    > > >>
    > > >>
    > > >> 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.qryUpdatenews p1,p2, p3
    > > >> conn.close : set conn = nothing
    > > >>
    > > >> --
    > > >> Mike Brind
    > > >
     
    Christo, Nov 15, 2006
    #7
  8. Christo

    Mike Brind Guest

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

    "Firas S Assaad" <> wrote in message
    news:...
    >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" <> wrote in message
    >> news:...
    >> > 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" <> wrote in message
    >> >> news:...
    >> >> > 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.QueryString("id"))
    >> >> >
    >> >> > Set dbCon = Server.CreateObject("ADODB.Connection")
    >> >> > dbCon.Open "DSN=cb2cwh"
    >> >> >
    >> >> > Set rsUpdate = Server.CreateObject("ADODB.Recordset")
    >> >> >
    >> >> > strSQL = "SELECT tNews.* FROM tNews WHERE id=" & RecordNo
    >> >> >
    >> >> > rsUpdate.CursorType = 2
    >> >> > rsUpdate.LockType = 3
    >> >> >
    >> >> > rsUpdate.Open strSQL, dbCon
    >> >> > rsUpdate.Fields("title") = Request.Form("title") '<<<<<<<<< LINE 21
    >> >> > rsUpdate.Fields("news") = Request.Form("news")
    >> >> > rsUpdate.fields("date") = Now()
    >> >> > rsUpdate.Update
    >> >> > rsUpdate.Close
    >> >> > Set rsUpdate = Nothing
    >> >> > Set dboCon = Nothing
    >> >> > Response.Redirect "deled_select.asp"
    >> >> > %>
    >> >> >
    >> >> > 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.
    >> >> >
    >> >> > http://www.webwizguide.info/asp/tutorials/updating_data_from_database.asp
    >> >> >
    >> >> > 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("title") 'no need to check for apostophes in e.g.
    >> >> King's
    >> >> Ransom Paid
    >> >> p2 = Request.Form("news")
    >> >> p3 = Request.Form("id")
    >> >>
    >> >>
    >> >> 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.qryUpdatenews p1,p2, p3
    >> >> conn.close : set conn = nothing
    >> >>
    >> >> --
    >> >> Mike Brind
    >> >

    >
     
    Mike Brind, Nov 15, 2006
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. bdb112
    Replies:
    45
    Views:
    1,370
    jazbees
    Apr 29, 2009
  2. J. Muenchbourg
    Replies:
    0
    Views:
    279
    J. Muenchbourg
    Jul 11, 2003
  3. BOF-EOF

    , Apr 12, 2007, in forum: ASP General
    Replies:
    1
    Views:
    124
    Daniel Crichton
    Apr 12, 2007
  4. .Net Sports
    Replies:
    0
    Views:
    213
    .Net Sports
    Jan 23, 2008
  5. GTN170777
    Replies:
    2
    Views:
    174
    Jeff Dillon
    Feb 28, 2008
Loading...

Share This Page