473,387 Members | 1,492 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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.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.

Nov 13 '06 #1
7 5305
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/...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.
Nov 13 '06 #2
"Christo" <cm*****@googlemail.comwrote in message
news:11*********************@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


Nov 13 '06 #3
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" <cm*****@googlemail.comwrote in message
news:11*********************@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
Nov 14 '06 #4
You'll be able to explain it just by looking at the database? Wow!

--
Mike Brind
"Firas S Assaad" <fi******@gmail.comwrote in message
news:11*********************@k70g2000cwa.googlegro ups.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" <cm*****@googlemail.comwrote in message
news:11*********************@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

Nov 14 '06 #5
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" <fi******@gmail.comwrote in message
news:11*********************@k70g2000cwa.googlegro ups.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" <cm*****@googlemail.comwrote in message
news:11*********************@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
Nov 14 '06 #6
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" <fi******@gmail.comwrote in message
news:11*********************@k70g2000cwa.googlegro ups.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" <cm*****@googlemail.comwrote in message
>news:11*********************@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
>
Nov 15 '06 #7
Think out of the box? For a BOF or EOF?? Gee - thanks for the advice.
I'll bear it in mind.

"Firas S Assaad" <fi******@gmail.comwrote in message
news:11**********************@m73g2000cwd.googlegr oups.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" <fi******@gmail.comwrote in message
news:11*********************@k70g2000cwa.googlegr oups.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" <cm*****@googlemail.comwrote in message
news:11*********************@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

Nov 15 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

46
by: Scott Chapman | last post by:
There seems to be an inconsistency here: Python 2.3.2 (#1, Oct 3 2003, 19:04:58) on linux2 >>> 1 == True True >>> 3 == True False >>> if 1: print "true" ....
3
by: drs | last post by:
I just upgraded my Python install, and for the first time have True and False rather than 1 and 0. I was playing around at the command line to test how they work (for instance, "if 9:" and "if...
35
by: Steven Bethard | last post by:
I have lists containing values that are all either True, False or None, e.g.: etc. For a given list: * If all values are None, the function should return None.
36
by: Remi Villatel | last post by:
Hi there, There is always a "nice" way to do things in Python but this time I can't find one. What I'm trying to achieve is a conditionnal loop of which the condition test would be done at...
14
by: Walter Dnes (delete the 'z' to get my real address | last post by:
I took a C course some time ago, but I'm only now beginning to use it, for a personal pet project. My current stumbling-block is finding an efficient way to find a match between the beginning of a...
48
by: Skybuck Flying | last post by:
Hi, I came across this C code which I wanted to understand etc it looked like this: if (-1) etc It made me wonder what the result would be... true or false ? In C and Delphi
30
by: Jason | last post by:
I am fairly new to ASP--I have been using it about 2 months. I did these tests (below), and it doesn't make sense to me. False is equal to 0, and that's fine. True should be equal to 1, but it's...
90
by: John Salerno | last post by:
I'm a little confused. Why doesn't s evaluate to True in the first part, but it does in the second? Is the first statement something different? False print 'hi' hi Thanks.
2
by: Ultrak The DBA | last post by:
Using the following query: select substr(reg_var_name,1,24) as reg_var_name, substr(reg_var_value, 1,12) as reg_var_value, level from table(sysproc.reg_list_variables()) as registryinfo; I am...
40
by: nufuhsus | last post by:
Hello all, First let me appologise if this has been answered but I could not find an acurate answer to this interesting problem. If the following is true: C:\Python25\rg.py>python Python...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.