Connecting Tech Pros Worldwide Help | Site Map

BOF or EOF is true?

Christo
Guest
 
Posts: n/a
#1: Nov 13 '06
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/tuto...m_database.asp

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

Bob Barrows [MVP]
Guest
 
Posts: n/a
#2: Nov 13 '06

re: BOF or EOF is true?


Christo wrote:
Quote:
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
Quote:
>
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>
Quote:
>
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/...e36562fee7804e

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

Access:
http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

http://groups.google.com/groups?hl=e...tngp13.phx.gbl

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.


Mike Brind
Guest
 
Posts: n/a
#3: Nov 13 '06

re: BOF or EOF is true?


"Christo" <cmw1985@googlemail.comwrote in message
news:1163425466.332847.15810@e3g2000cwe.googlegrou ps.com...
Quote:
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/tuto...m_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
Guest
 
Posts: n/a
#4: Nov 14 '06

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:
Quote:
"Christo" <cmw1985@googlemail.comwrote in message
news:1163425466.332847.15810@e3g2000cwe.googlegrou ps.com...
Quote:
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/tuto...m_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
Guest
 
Posts: n/a
#5: Nov 14 '06

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@k70g2000cwa.googlegro ups.com...
Quote:
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:
Quote:
>"Christo" <cmw1985@googlemail.comwrote in message
>news:1163425466.332847.15810@e3g2000cwe.googlegro ups.com...
Quote:
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/tuto...m_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
Guest
 
Posts: n/a
#6: Nov 14 '06

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:
Quote:
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@k70g2000cwa.googlegro ups.com...
Quote:
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:
Quote:
"Christo" <cmw1985@googlemail.comwrote in message
news:1163425466.332847.15810@e3g2000cwe.googlegrou ps.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.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/tuto...m_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
Guest
 
Posts: n/a
#7: Nov 15 '06

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:
Quote:
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:
Quote:
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@k70g2000cwa.googlegro ups.com...
Quote:
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@googlemail.comwrote in message
>news:1163425466.332847.15810@e3g2000cwe.googlegro ups.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.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/tuto...m_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
Guest
 
Posts: n/a
#8: Nov 15 '06

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.googlegr oups.com...
Quote:
>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:
Quote:
>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@k70g2000cwa.googlegr oups.com...
Quote:
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@googlemail.comwrote in message
>news:1163425466.332847.15810@e3g2000cwe.googlegro ups.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.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/tuto...m_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
>
>

Closed Thread