473,386 Members | 1,785 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,386 software developers and data experts.

Recordset Errors / Friendly Message needed

My brain is nuked....Can anybody tell me right off the bat what is
wrong with this code? Along with any glaring errors, please let me
know the syntax to display a message (Response.Write would be fine I
think) that will say "I'm sorry but the data you requested cannot be
found" or something along those lines....

This code is on an archive page I have on my company's intranet....The
end result is to show 3 records at a time pulled from an Access DB and
display on the screen....If the information IS found, everything seems
to work alright but if it's not I get the error msg listed....Instead
of that error msg I'd like to get the friendly message for the user
basically saying "Sorry but your info can't be found" (see
above)....Any help/suggestions would be great....I'm fried....In the
process of trying to improve my work I broke it....I'm a newbie to ASP
so please, hook a brother up with some advice...

My error message....
*****
ADODB.Recordset error '800a0bcd'

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

/jax/wh/Online_Forms/Secured_Archives/search_files/search_results_wave.asp,
line 57
*****

My code from search_results_wave.asp....
*****
<!-- #INCLUDE VIRTUAL="/_borders/top_nav.asp" -->

<%

Mode = request.form("mode")
Name = request.form("name")
Shift = request.form("shift")
Wave = request.form("wave")
Carton = request.form("carton")
Location = request.form("location")
License = request.form("license")
Sku = request.form("sku")
Qty = request.form("quantity")
Reason = request.form("reason")
Comments = request.form("comments")
waveyear = request.form("waveyear")
wavemonth = request.form("wavemonth")
waveday = request.form("waveday")
wavenumber = request.form("wavenumber")

'************************************************* ****************************
'* DATABASE APPENDING
*
'************************************************* ****************************
If IsEmpty (Request.QueryString("pageNum")) Then
curPage = 1
Else
curPage = CInt(Request.QueryString("pageNum"))
End If

'create db connection
Set dbconn = Server.CreateObject("ADODB.Connection")

'open db in a DSN-less method
dbconn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&
Server.MapPath("/jax/wh/Online_Forms/Secured_Archives/search_files/shortage.mdb")

'create recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

'specify more info about rs
rs.CursorLocation = 3
rs.CursorType = 3
rs.PageSize = 3
rs.open "shortage", dbconn

'sql statement to return input values drawn from html fields within
previous week
SQLqry = "SELECT * FROM shortage WHERE wave = '"&waveyear& wavemonth&
waveday& wavenumber&"'"

'display results of statement on screen for testing purposes
Response.Write "<h3><b><u>" & (SQLqry) & "</u></b></h3><br>"

'execute SQL statement
'Set db = dbconn.Execute(SQLqry)

rs.Close
rs.Open SQLqry

rs.AbsolutePage = curPage
Response.Write "<p>You are on page: " & curPage & " of " &
rs.PageCount
Response.Write "<br>"
Response.Write "<br>"

For i = 1 to rs.PageSize
If rs.EOF Then Exit For
Response.Write "<b>Name :</b> " & rs("name")
Response.Write "<br>"
Response.Write "<b>Shift :</b> " & rs("shift")
Response.Write "<br>"
Response.Write "<b>Wave Number :</b> " & rs("wave")
Response.Write "<br>"
Response.Write "<b>Carton Number :</b> " & rs("carton")
Response.Write "<br>"
Response.Write "<b>Location :</b> " & rs("location")
Response.Write "<br>"
Response.Write "<b>License :</b> " & rs("license")
Response.Write "<br>"
Response.Write "<b>SKU :</b> " & rs("sku")
Response.Write "<br>"
Response.Write "<b>Quantity :</b> " & rs("qty")
Response.Write "<br>"
Response.Write "<b>Reason :</b> " & rs("reason")
Response.Write "<br>"
Response.Write "<b>Comments :</b> " & rs("comments")
Response.Write "<br>"
Response.Write "<b>Date Submitted :</b> " & rs("date")
Response.Write "<hr>"
rs.MoveNext
Next

If curPage > 1 then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage-1 & "'>Previous</a>"
If curPage < rs.PageCount then
Response.Write " | "
end if
end if
If curPage < rs.PageCount then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage+1 & "'>Next</a>"
end if

'close recordset
rs.Close

'zero out recordset object
Set rs = Nothing

'smack around the db connection until it lets go
dbconn.Close

'terminate db connection with extreme prejudice
set dbconn = nothing

%>

<br><a href="../Archives.asp">Return to Archives</a>
<br><a href="../../Shortage.asp">Return to Shortage Submission
Form</a>
<br><a href="../../../default.asp">Return to Warehouse
Operations</a><!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->
*****
Jul 19 '05 #1
8 2282
First, better paging techniques:

http://www.aspfaq.com/2120

Second,

set rs = conn.execute(sql)
if rs.eof then
response.write "Hi, I'm a friendly error message. You won't be
seeing any data today."
else
' do stuff
end if

--
http://www.aspfaq.com/
(Reverse address to reply.)


"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
My brain is nuked....Can anybody tell me right off the bat what is
wrong with this code? Along with any glaring errors, please let me
know the syntax to display a message (Response.Write would be fine I
think) that will say "I'm sorry but the data you requested cannot be
found" or something along those lines....

This code is on an archive page I have on my company's intranet....The
end result is to show 3 records at a time pulled from an Access DB and
display on the screen....If the information IS found, everything seems
to work alright but if it's not I get the error msg listed....Instead
of that error msg I'd like to get the friendly message for the user
basically saying "Sorry but your info can't be found" (see
above)....Any help/suggestions would be great....I'm fried....In the
process of trying to improve my work I broke it....I'm a newbie to ASP
so please, hook a brother up with some advice...

My error message....
*****
ADODB.Recordset error '800a0bcd'

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

/jax/wh/Online_Forms/Secured_Archives/search_files/search_results_wave.asp, line 57
*****

My code from search_results_wave.asp....
*****
<!-- #INCLUDE VIRTUAL="/_borders/top_nav.asp" -->

<%

Mode = request.form("mode")
Name = request.form("name")
Shift = request.form("shift")
Wave = request.form("wave")
Carton = request.form("carton")
Location = request.form("location")
License = request.form("license")
Sku = request.form("sku")
Qty = request.form("quantity")
Reason = request.form("reason")
Comments = request.form("comments")
waveyear = request.form("waveyear")
wavemonth = request.form("wavemonth")
waveday = request.form("waveday")
wavenumber = request.form("wavenumber")

'************************************************* **************************
** '* DATABASE APPENDING
*
'************************************************* **************************
** If IsEmpty (Request.QueryString("pageNum")) Then
curPage = 1
Else
curPage = CInt(Request.QueryString("pageNum"))
End If

'create db connection
Set dbconn = Server.CreateObject("ADODB.Connection")

'open db in a DSN-less method
dbconn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&
Server.MapPath("/jax/wh/Online_Forms/Secured_Archives/search_files/shortage.
mdb")
'create recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

'specify more info about rs
rs.CursorLocation = 3
rs.CursorType = 3
rs.PageSize = 3
rs.open "shortage", dbconn

'sql statement to return input values drawn from html fields within
previous week
SQLqry = "SELECT * FROM shortage WHERE wave = '"&waveyear& wavemonth&
waveday& wavenumber&"'"

'display results of statement on screen for testing purposes
Response.Write "<h3><b><u>" & (SQLqry) & "</u></b></h3><br>"

'execute SQL statement
'Set db = dbconn.Execute(SQLqry)

rs.Close
rs.Open SQLqry

rs.AbsolutePage = curPage
Response.Write "<p>You are on page: " & curPage & " of " &
rs.PageCount
Response.Write "<br>"
Response.Write "<br>"

For i = 1 to rs.PageSize
If rs.EOF Then Exit For
Response.Write "<b>Name :</b> " & rs("name")
Response.Write "<br>"
Response.Write "<b>Shift :</b> " & rs("shift")
Response.Write "<br>"
Response.Write "<b>Wave Number :</b> " & rs("wave")
Response.Write "<br>"
Response.Write "<b>Carton Number :</b> " & rs("carton")
Response.Write "<br>"
Response.Write "<b>Location :</b> " & rs("location")
Response.Write "<br>"
Response.Write "<b>License :</b> " & rs("license")
Response.Write "<br>"
Response.Write "<b>SKU :</b> " & rs("sku")
Response.Write "<br>"
Response.Write "<b>Quantity :</b> " & rs("qty")
Response.Write "<br>"
Response.Write "<b>Reason :</b> " & rs("reason")
Response.Write "<br>"
Response.Write "<b>Comments :</b> " & rs("comments")
Response.Write "<br>"
Response.Write "<b>Date Submitted :</b> " & rs("date")
Response.Write "<hr>"
rs.MoveNext
Next

If curPage > 1 then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage-1 & "'>Previous</a>"
If curPage < rs.PageCount then
Response.Write " | "
end if
end if
If curPage < rs.PageCount then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage+1 & "'>Next</a>"
end if

'close recordset
rs.Close

'zero out recordset object
Set rs = Nothing

'smack around the db connection until it lets go
dbconn.Close

'terminate db connection with extreme prejudice
set dbconn = nothing

%>

<br><a href="../Archives.asp">Return to Archives</a>
<br><a href="../../Shortage.asp">Return to Shortage Submission
Form</a>
<br><a href="../../../default.asp">Return to Warehouse
Operations</a><!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->
*****

Jul 19 '05 #2
The error you mentioned means the record thats been requested does not exist
in the database.

All I do to get past this is use a function that queries the database for
the record # thats requested, and re-dir to a friendly "stop requesting
invalid records" page ;o)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
My brain is nuked....Can anybody tell me right off the bat what is
wrong with this code? Along with any glaring errors, please let me
know the syntax to display a message (Response.Write would be fine I
think) that will say "I'm sorry but the data you requested cannot be
found" or something along those lines....

This code is on an archive page I have on my company's intranet....The
end result is to show 3 records at a time pulled from an Access DB and
display on the screen....If the information IS found, everything seems
to work alright but if it's not I get the error msg listed....Instead
of that error msg I'd like to get the friendly message for the user
basically saying "Sorry but your info can't be found" (see
above)....Any help/suggestions would be great....I'm fried....In the
process of trying to improve my work I broke it....I'm a newbie to ASP
so please, hook a brother up with some advice...

My error message....
*****
ADODB.Recordset error '800a0bcd'

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

/jax/wh/Online_Forms/Secured_Archives/search_files/search_results_wave.asp, line 57
*****

My code from search_results_wave.asp....
*****
<!-- #INCLUDE VIRTUAL="/_borders/top_nav.asp" -->

<%

Mode = request.form("mode")
Name = request.form("name")
Shift = request.form("shift")
Wave = request.form("wave")
Carton = request.form("carton")
Location = request.form("location")
License = request.form("license")
Sku = request.form("sku")
Qty = request.form("quantity")
Reason = request.form("reason")
Comments = request.form("comments")
waveyear = request.form("waveyear")
wavemonth = request.form("wavemonth")
waveday = request.form("waveday")
wavenumber = request.form("wavenumber")

'************************************************* **************************
** '* DATABASE APPENDING
*
'************************************************* **************************
** If IsEmpty (Request.QueryString("pageNum")) Then
curPage = 1
Else
curPage = CInt(Request.QueryString("pageNum"))
End If

'create db connection
Set dbconn = Server.CreateObject("ADODB.Connection")

'open db in a DSN-less method
dbconn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&
Server.MapPath("/jax/wh/Online_Forms/Secured_Archives/search_files/shortage.
mdb")
'create recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

'specify more info about rs
rs.CursorLocation = 3
rs.CursorType = 3
rs.PageSize = 3
rs.open "shortage", dbconn

'sql statement to return input values drawn from html fields within
previous week
SQLqry = "SELECT * FROM shortage WHERE wave = '"&waveyear& wavemonth&
waveday& wavenumber&"'"

'display results of statement on screen for testing purposes
Response.Write "<h3><b><u>" & (SQLqry) & "</u></b></h3><br>"

'execute SQL statement
'Set db = dbconn.Execute(SQLqry)

rs.Close
rs.Open SQLqry

rs.AbsolutePage = curPage
Response.Write "<p>You are on page: " & curPage & " of " &
rs.PageCount
Response.Write "<br>"
Response.Write "<br>"

For i = 1 to rs.PageSize
If rs.EOF Then Exit For
Response.Write "<b>Name :</b> " & rs("name")
Response.Write "<br>"
Response.Write "<b>Shift :</b> " & rs("shift")
Response.Write "<br>"
Response.Write "<b>Wave Number :</b> " & rs("wave")
Response.Write "<br>"
Response.Write "<b>Carton Number :</b> " & rs("carton")
Response.Write "<br>"
Response.Write "<b>Location :</b> " & rs("location")
Response.Write "<br>"
Response.Write "<b>License :</b> " & rs("license")
Response.Write "<br>"
Response.Write "<b>SKU :</b> " & rs("sku")
Response.Write "<br>"
Response.Write "<b>Quantity :</b> " & rs("qty")
Response.Write "<br>"
Response.Write "<b>Reason :</b> " & rs("reason")
Response.Write "<br>"
Response.Write "<b>Comments :</b> " & rs("comments")
Response.Write "<br>"
Response.Write "<b>Date Submitted :</b> " & rs("date")
Response.Write "<hr>"
rs.MoveNext
Next

If curPage > 1 then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage-1 & "'>Previous</a>"
If curPage < rs.PageCount then
Response.Write " | "
end if
end if
If curPage < rs.PageCount then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage+1 & "'>Next</a>"
end if

'close recordset
rs.Close

'zero out recordset object
Set rs = Nothing

'smack around the db connection until it lets go
dbconn.Close

'terminate db connection with extreme prejudice
set dbconn = nothing

%>

<br><a href="../Archives.asp">Return to Archives</a>
<br><a href="../../Shortage.asp">Return to Shortage Submission
Form</a>
<br><a href="../../../default.asp">Return to Warehouse
Operations</a><!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->
*****

Jul 19 '05 #3
How exactly can I go about doing that? I mean what is the syntax for
that option? I've been playing around with If statements and "Do Until
rs.EOF" statements and I keep breaking it....Things work great if the
data is found but if the string that is being searched for is not
found, it crashes...

"Steven Burn" <pv*@noyb.com> wrote in message news:<ev**************@TK2MSFTNGP12.phx.gbl>...
The error you mentioned means the record thats been requested does not exist
in the database.

All I do to get past this is use a function that queries the database for
the record # thats requested, and re-dir to a friendly "stop requesting
invalid records" page ;o)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
My brain is nuked....Can anybody tell me right off the bat what is
wrong with this code? Along with any glaring errors, please let me
know the syntax to display a message (Response.Write would be fine I
think) that will say "I'm sorry but the data you requested cannot be
found" or something along those lines....

This code is on an archive page I have on my company's intranet....The
end result is to show 3 records at a time pulled from an Access DB and
display on the screen....If the information IS found, everything seems
to work alright but if it's not I get the error msg listed....Instead
of that error msg I'd like to get the friendly message for the user
basically saying "Sorry but your info can't be found" (see
above)....Any help/suggestions would be great....I'm fried....In the
process of trying to improve my work I broke it....I'm a newbie to ASP
so please, hook a brother up with some advice...

My error message....
*****
ADODB.Recordset error '800a0bcd'

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

/jax/wh/Online_Forms/Secured_Archives/search_files/search_results_wave.asp,
line 57
*****

My code from search_results_wave.asp....
*****
<!-- #INCLUDE VIRTUAL="/_borders/top_nav.asp" -->

<%

Mode = request.form("mode")
Name = request.form("name")
Shift = request.form("shift")
Wave = request.form("wave")
Carton = request.form("carton")
Location = request.form("location")
License = request.form("license")
Sku = request.form("sku")
Qty = request.form("quantity")
Reason = request.form("reason")
Comments = request.form("comments")
waveyear = request.form("waveyear")
wavemonth = request.form("wavemonth")
waveday = request.form("waveday")
wavenumber = request.form("wavenumber")

'************************************************* **************************
**
'* DATABASE APPENDING
*

'************************************************* **************************
**
If IsEmpty (Request.QueryString("pageNum")) Then
curPage = 1
Else
curPage = CInt(Request.QueryString("pageNum"))
End If

'create db connection
Set dbconn = Server.CreateObject("ADODB.Connection")

'open db in a DSN-less method
dbconn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&

Server.MapPath("/jax/wh/Online_Forms/Secured_Archives/search_files/shortage.
mdb")

'create recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

'specify more info about rs
rs.CursorLocation = 3
rs.CursorType = 3
rs.PageSize = 3
rs.open "shortage", dbconn

'sql statement to return input values drawn from html fields within
previous week
SQLqry = "SELECT * FROM shortage WHERE wave = '"&waveyear& wavemonth&
waveday& wavenumber&"'"

'display results of statement on screen for testing purposes
Response.Write "<h3><b><u>" & (SQLqry) & "</u></b></h3><br>"

'execute SQL statement
'Set db = dbconn.Execute(SQLqry)

rs.Close
rs.Open SQLqry

rs.AbsolutePage = curPage
Response.Write "<p>You are on page: " & curPage & " of " &
rs.PageCount
Response.Write "<br>"
Response.Write "<br>"

For i = 1 to rs.PageSize
If rs.EOF Then Exit For
Response.Write "<b>Name :</b> " & rs("name")
Response.Write "<br>"
Response.Write "<b>Shift :</b> " & rs("shift")
Response.Write "<br>"
Response.Write "<b>Wave Number :</b> " & rs("wave")
Response.Write "<br>"
Response.Write "<b>Carton Number :</b> " & rs("carton")
Response.Write "<br>"
Response.Write "<b>Location :</b> " & rs("location")
Response.Write "<br>"
Response.Write "<b>License :</b> " & rs("license")
Response.Write "<br>"
Response.Write "<b>SKU :</b> " & rs("sku")
Response.Write "<br>"
Response.Write "<b>Quantity :</b> " & rs("qty")
Response.Write "<br>"
Response.Write "<b>Reason :</b> " & rs("reason")
Response.Write "<br>"
Response.Write "<b>Comments :</b> " & rs("comments")
Response.Write "<br>"
Response.Write "<b>Date Submitted :</b> " & rs("date")
Response.Write "<hr>"
rs.MoveNext
Next

If curPage > 1 then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage-1 & "'>Previous</a>"
If curPage < rs.PageCount then
Response.Write " | "
end if
end if
If curPage < rs.PageCount then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage+1 & "'>Next</a>"
end if

'close recordset
rs.Close

'zero out recordset object
Set rs = Nothing

'smack around the db connection until it lets go
dbconn.Close

'terminate db connection with extreme prejudice
set dbconn = nothing

%>

<br><a href="../Archives.asp">Return to Archives</a>
<br><a href="../../Shortage.asp">Return to Shortage Submission
Form</a>
<br><a href="../../../default.asp">Return to Warehouse
Operations</a><!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->
*****

Jul 19 '05 #4
'// Replace the_database.mdb with the filename of your database
Const objDB = "the_Database.mdb"

Function ConnectToDB(dbPath)
'// The code you use to connect to your database goes here
Set DB = Server.Createobject("ADODB.Connection")
DB.Mode = adModeReadWrite
DB.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" +
Server.MapPath(dbPath))
Set ConnectToDB = DB
End Function

Function RecordExists(sID)
Set DB = ConnectToDB(objDB)
Set rst = Server.CreateObject("ADODB.Recordset")
rst.open "Select ID from tblSomeTable", DB, adOpenStatic, adLockReadOnly
Do While Not rst.eof
If CLng(rst("ID"))=CLng(sID) Then
RecordExists = true
Exit Do
End If
rst.Movenext
Loop
End Function

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
How exactly can I go about doing that? I mean what is the syntax for
that option? I've been playing around with If statements and "Do Until
rs.EOF" statements and I keep breaking it....Things work great if the
data is found but if the string that is being searched for is not
found, it crashes...

"Steven Burn" <pv*@noyb.com> wrote in message

news:<ev**************@TK2MSFTNGP12.phx.gbl>...
The error you mentioned means the record thats been requested does not exist
in the database.

All I do to get past this is use a function that queries the database for the record # thats requested, and re-dir to a friendly "stop requesting
invalid records" page ;o)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
My brain is nuked....Can anybody tell me right off the bat what is
wrong with this code? Along with any glaring errors, please let me
know the syntax to display a message (Response.Write would be fine I
think) that will say "I'm sorry but the data you requested cannot be
found" or something along those lines....

This code is on an archive page I have on my company's intranet....The
end result is to show 3 records at a time pulled from an Access DB and
display on the screen....If the information IS found, everything seems
to work alright but if it's not I get the error msg listed....Instead
of that error msg I'd like to get the friendly message for the user
basically saying "Sorry but your info can't be found" (see
above)....Any help/suggestions would be great....I'm fried....In the
process of trying to improve my work I broke it....I'm a newbie to ASP
so please, hook a brother up with some advice...

My error message....
*****
ADODB.Recordset error '800a0bcd'

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

/jax/wh/Online_Forms/Secured_Archives/search_files/search_results_wave.asp,
line 57
*****

My code from search_results_wave.asp....
*****
<!-- #INCLUDE VIRTUAL="/_borders/top_nav.asp" -->

<%

Mode = request.form("mode")
Name = request.form("name")
Shift = request.form("shift")
Wave = request.form("wave")
Carton = request.form("carton")
Location = request.form("location")
License = request.form("license")
Sku = request.form("sku")
Qty = request.form("quantity")
Reason = request.form("reason")
Comments = request.form("comments")
waveyear = request.form("waveyear")
wavemonth = request.form("wavemonth")
waveday = request.form("waveday")
wavenumber = request.form("wavenumber")

'************************************************* ************************** **
'* DATABASE APPENDING
*

'************************************************* ************************** **
If IsEmpty (Request.QueryString("pageNum")) Then
curPage = 1
Else
curPage = CInt(Request.QueryString("pageNum"))
End If

'create db connection
Set dbconn = Server.CreateObject("ADODB.Connection")

'open db in a DSN-less method
dbconn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&

Server.MapPath("/jax/wh/Online_Forms/Secured_Archives/search_files/shortage. mdb")

'create recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

'specify more info about rs
rs.CursorLocation = 3
rs.CursorType = 3
rs.PageSize = 3
rs.open "shortage", dbconn

'sql statement to return input values drawn from html fields within
previous week
SQLqry = "SELECT * FROM shortage WHERE wave = '"&waveyear& wavemonth&
waveday& wavenumber&"'"

'display results of statement on screen for testing purposes
Response.Write "<h3><b><u>" & (SQLqry) & "</u></b></h3><br>"

'execute SQL statement
'Set db = dbconn.Execute(SQLqry)

rs.Close
rs.Open SQLqry

rs.AbsolutePage = curPage
Response.Write "<p>You are on page: " & curPage & " of " &
rs.PageCount
Response.Write "<br>"
Response.Write "<br>"

For i = 1 to rs.PageSize
If rs.EOF Then Exit For
Response.Write "<b>Name :</b> " & rs("name")
Response.Write "<br>"
Response.Write "<b>Shift :</b> " & rs("shift")
Response.Write "<br>"
Response.Write "<b>Wave Number :</b> " & rs("wave")
Response.Write "<br>"
Response.Write "<b>Carton Number :</b> " & rs("carton")
Response.Write "<br>"
Response.Write "<b>Location :</b> " & rs("location")
Response.Write "<br>"
Response.Write "<b>License :</b> " & rs("license")
Response.Write "<br>"
Response.Write "<b>SKU :</b> " & rs("sku")
Response.Write "<br>"
Response.Write "<b>Quantity :</b> " & rs("qty")
Response.Write "<br>"
Response.Write "<b>Reason :</b> " & rs("reason")
Response.Write "<br>"
Response.Write "<b>Comments :</b> " & rs("comments")
Response.Write "<br>"
Response.Write "<b>Date Submitted :</b> " & rs("date")
Response.Write "<hr>"
rs.MoveNext
Next

If curPage > 1 then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage-1 & "'>Previous</a>"
If curPage < rs.PageCount then
Response.Write " | "
end if
end if
If curPage < rs.PageCount then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage+1 & "'>Next</a>"
end if

'close recordset
rs.Close

'zero out recordset object
Set rs = Nothing

'smack around the db connection until it lets go
dbconn.Close

'terminate db connection with extreme prejudice
set dbconn = nothing

%>

<br><a href="../Archives.asp">Return to Archives</a>
<br><a href="../../Shortage.asp">Return to Shortage Submission
Form</a>
<br><a href="../../../default.asp">Return to Warehouse
Operations</a><!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->
*****

Jul 19 '05 #5
I have inserted my own variables into this code and still no luck....I
kept getting an error message that it an object was
required....Tracking it down to the line containing "rs.Open SQLqry" I
think it's because my first mention of the recordset variable "rs" is
within the "Function RecordExists(sID)" code...I've tried opening and
closing it OUTSIDE of the function and it's not working....Once again,
I'm a bit frazzled (still new to me) and this is the code I currently
have...

I took the code OUTSIDE of the function....Probably not a good idea
but that was part of my experimenting....Take a look and then e-slap
me...
*****
<%

Mode = request.form("mode")
Name = request.form("name")
Shift = request.form("shift")
Wave = request.form("wave")
Carton = request.form("carton")
Location = request.form("location")
License = request.form("license")
Sku = request.form("sku")
Qty = request.form("quantity")
Reason = request.form("reason")
Comments = request.form("comments")
waveyear = request.form("waveyear")
wavemonth = request.form("wavemonth")
waveday = request.form("waveday")
wavenumber = request.form("wavenumber")
entirewave = request.form("waveyear") & request.form("wavemonth") &
request.form("waveday") & request.form("wavenumber")

'************************************************* ****************************
'* DATABASE APPENDING
*
'************************************************* ****************************
'create db connection
Set dbconn = Server.CreateObject("ADODB.Connection")
dbconn.Mode = adModeReadWrite

'open db in a DSN-less method
dbconn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&
Server.MapPath("/jax/wh/Online_Forms/Secured_Archives/search_files/shortage.mdb")

Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.CursorType = 3
rs.PageSize = 3
rs.open "shortage", dbconn

Do While Not rs.eof
If CLng(entirewave)=Null Then
RecordExists = false
Exit Do
End If
rs.Movenext
Loop
rs.Close

If IsEmpty (Request.QueryString("pageNum")) Then
curPage = 1
Else
curPage = CInt(Request.QueryString("pageNum"))
End If

'create recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

'sql statement to return input values drawn from html fields within
previous week
SQLqry = "SELECT * FROM shortage WHERE wave = '"&waveyear& wavemonth&
waveday& wavenumber&"'"

'display results of statement on screen for testing purposes
Response.Write "<h3><b><u>" & (SQLqry) & "</u></b></h3><br>"

rs.Open SQLqry

rs.AbsolutePage = curPage
Response.Write "<p>You are on page: " & curPage & " of " &
rs.PageCount
Response.Write "<br>"
Response.Write "<br>"

For i = 1 to rs.PageSize
If rs.EOF Then Exit For
Response.Write "<b>Name :</b> " & rs("name")
Response.Write "<br>"
Response.Write "<b>Shift :</b> " & rs("shift")
Response.Write "<br>"
Response.Write "<b>Wave Number :</b> " & rs("wave")
Response.Write "<br>"
Response.Write "<b>Carton Number :</b> " & rs("carton")
Response.Write "<br>"
Response.Write "<b>Location :</b> " & rs("location")
Response.Write "<br>"
Response.Write "<b>License :</b> " & rs("license")
Response.Write "<br>"
Response.Write "<b>SKU :</b> " & rs("sku")
Response.Write "<br>"
Response.Write "<b>Quantity :</b> " & rs("qty")
Response.Write "<br>"
Response.Write "<b>Reason :</b> " & rs("reason")
Response.Write "<br>"
Response.Write "<b>Comments :</b> " & rs("comments")
Response.Write "<br>"
Response.Write "<b>Date Submitted :</b> " & rs("date")
Response.Write "<hr>"
rs.MoveNext
Next
If curPage > 1 then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage-1 & "'>Previous</a>"
If curPage < rs.PageCount then
Response.Write " | "
end if
end if
If curPage < rs.PageCount then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage+1 & "'>Next</a>"
end if

'close recordset
rs.Close

'zero out recordset object
Set rs = Nothing

'smack around the db connection until it lets go
dbconn.Close

'terminate db connection with extreme prejudice
set dbconn = nothing
%>

*****
"Steven Burn" <pv*@noyb.com> wrote in message news:<#1**************@TK2MSFTNGP09.phx.gbl>...
'// Replace the_database.mdb with the filename of your database
Const objDB = "the_Database.mdb"

Function ConnectToDB(dbPath)
'// The code you use to connect to your database goes here
Set DB = Server.Createobject("ADODB.Connection")
DB.Mode = adModeReadWrite
DB.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" +
Server.MapPath(dbPath))
Set ConnectToDB = DB
End Function

Function RecordExists(sID)
Set DB = ConnectToDB(objDB)
Set rst = Server.CreateObject("ADODB.Recordset")
rst.open "Select ID from tblSomeTable", DB, adOpenStatic, adLockReadOnly
Do While Not rst.eof
If CLng(rst("ID"))=CLng(sID) Then
RecordExists = true
Exit Do
End If
rst.Movenext
Loop
End Function

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
How exactly can I go about doing that? I mean what is the syntax for
that option? I've been playing around with If statements and "Do Until
rs.EOF" statements and I keep breaking it....Things work great if the
data is found but if the string that is being searched for is not
found, it crashes...

"Steven Burn" <pv*@noyb.com> wrote in message

news:<ev**************@TK2MSFTNGP12.phx.gbl>...
The error you mentioned means the record thats been requested does not exist in the database.

All I do to get past this is use a function that queries the database for the record # thats requested, and re-dir to a friendly "stop requesting
invalid records" page ;o)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
> My brain is nuked....Can anybody tell me right off the bat what is
> wrong with this code? Along with any glaring errors, please let me
> know the syntax to display a message (Response.Write would be fine I
> think) that will say "I'm sorry but the data you requested cannot be
> found" or something along those lines....
>
> This code is on an archive page I have on my company's intranet....The
> end result is to show 3 records at a time pulled from an Access DB and
> display on the screen....If the information IS found, everything seems
> to work alright but if it's not I get the error msg listed....Instead
> of that error msg I'd like to get the friendly message for the user
> basically saying "Sorry but your info can't be found" (see
> above)....Any help/suggestions would be great....I'm fried....In the
> process of trying to improve my work I broke it....I'm a newbie to ASP
> so please, hook a brother up with some advice...
>
> My error message....
> *****
> ADODB.Recordset error '800a0bcd'
>
> Either BOF or EOF is True, or the current record has been deleted.
> Requested operation requires a current record.
>
>
/jax/wh/Online_Forms/Secured_Archives/search_files/search_results_wave.asp, > line 57
> *****
>
> My code from search_results_wave.asp....
> *****
> <!-- #INCLUDE VIRTUAL="/_borders/top_nav.asp" -->
>
> <%
>
> Mode = request.form("mode")
> Name = request.form("name")
> Shift = request.form("shift")
> Wave = request.form("wave")
> Carton = request.form("carton")
> Location = request.form("location")
> License = request.form("license")
> Sku = request.form("sku")
> Qty = request.form("quantity")
> Reason = request.form("reason")
> Comments = request.form("comments")
> waveyear = request.form("waveyear")
> wavemonth = request.form("wavemonth")
> waveday = request.form("waveday")
> wavenumber = request.form("wavenumber")
>
>
'************************************************* ************************** **
> '* DATABASE APPENDING
> *
>
'************************************************* ************************** **
> If IsEmpty (Request.QueryString("pageNum")) Then
> curPage = 1
> Else
> curPage = CInt(Request.QueryString("pageNum"))
> End If
>
> 'create db connection
> Set dbconn = Server.CreateObject("ADODB.Connection")
>
> 'open db in a DSN-less method
> dbconn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&
>
Server.MapPath("/jax/wh/Online_Forms/Secured_Archives/search_files/shortage. mdb")
>
> 'create recordset object
> Set rs = Server.CreateObject("ADODB.Recordset")
>
> 'specify more info about rs
> rs.CursorLocation = 3
> rs.CursorType = 3
> rs.PageSize = 3
> rs.open "shortage", dbconn
>
> 'sql statement to return input values drawn from html fields within
> previous week
> SQLqry = "SELECT * FROM shortage WHERE wave = '"&waveyear& wavemonth&
> waveday& wavenumber&"'"
>
> 'display results of statement on screen for testing purposes
> Response.Write "<h3><b><u>" & (SQLqry) & "</u></b></h3><br>"
>
> 'execute SQL statement
> 'Set db = dbconn.Execute(SQLqry)
>
> rs.Close
> rs.Open SQLqry
>
> rs.AbsolutePage = curPage
> Response.Write "<p>You are on page: " & curPage & " of " &
> rs.PageCount
> Response.Write "<br>"
> Response.Write "<br>"
>
> For i = 1 to rs.PageSize
> If rs.EOF Then Exit For
> Response.Write "<b>Name :</b> " & rs("name")
> Response.Write "<br>"
> Response.Write "<b>Shift :</b> " & rs("shift")
> Response.Write "<br>"
> Response.Write "<b>Wave Number :</b> " & rs("wave")
> Response.Write "<br>"
> Response.Write "<b>Carton Number :</b> " & rs("carton")
> Response.Write "<br>"
> Response.Write "<b>Location :</b> " & rs("location")
> Response.Write "<br>"
> Response.Write "<b>License :</b> " & rs("license")
> Response.Write "<br>"
> Response.Write "<b>SKU :</b> " & rs("sku")
> Response.Write "<br>"
> Response.Write "<b>Quantity :</b> " & rs("qty")
> Response.Write "<br>"
> Response.Write "<b>Reason :</b> " & rs("reason")
> Response.Write "<br>"
> Response.Write "<b>Comments :</b> " & rs("comments")
> Response.Write "<br>"
> Response.Write "<b>Date Submitted :</b> " & rs("date")
> Response.Write "<hr>"
> rs.MoveNext
> Next
>
> If curPage > 1 then
> Response.Write "<a href='search_results_wave.asp?pageNum=" &
> curPage-1 & "'>Previous</a>"
> If curPage < rs.PageCount then
> Response.Write " | "
> end if
> end if
> If curPage < rs.PageCount then
> Response.Write "<a href='search_results_wave.asp?pageNum=" &
> curPage+1 & "'>Next</a>"
> end if
>
> 'close recordset
> rs.Close
>
> 'zero out recordset object
> Set rs = Nothing
>
> 'smack around the db connection until it lets go
> dbconn.Close
>
> 'terminate db connection with extreme prejudice
> set dbconn = nothing
>
> %>
>
> <br><a href="../Archives.asp">Return to Archives</a>
> <br><a href="../../Shortage.asp">Return to Shortage Submission
> Form</a>
> <br><a href="../../../default.asp">Return to Warehouse
> Operations</a><!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->
> *****

Jul 19 '05 #6
UGH. No wonder your brain is nuked.

Let's start here. What is the RESULT of:

'display results of statement on screen for testing purposes
Response.Write "<h3><b><u>" & (SQLqry) & "</u></b></h3><br>"

It's great to see that you are attempting to perform some debugging, but
unless you show us what that produced, there's not much we can do.

--
http://www.aspfaq.com/
(Reverse address to reply.)
Jul 19 '05 #7
Just a guess but, I'd say the problem is your using the following;

SQLqry = "SELECT * FROM shortage WHERE wave = '"&waveyear& wavemonth&
waveday& wavenumber&"'"

Instead of first checking that the record actually exists....... (you need
to check the record actually exists, BEFORE it gets to this line)

i.e.

If RecordExists(Request.Querystring("Whatever")) Then
'// Your code goes here.....
Else
Response.Write "No record found"
Response.End
End if

I'd also advise not using "Select * FROM" and instead using "Select <table
names> FROM" (there's an ASPFAQ article on it somewhere concerning the why's
and why not's)

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
I have inserted my own variables into this code and still no luck....I
kept getting an error message that it an object was
required....Tracking it down to the line containing "rs.Open SQLqry" I
think it's because my first mention of the recordset variable "rs" is
within the "Function RecordExists(sID)" code...I've tried opening and
closing it OUTSIDE of the function and it's not working....Once again,
I'm a bit frazzled (still new to me) and this is the code I currently
have...

I took the code OUTSIDE of the function....Probably not a good idea
but that was part of my experimenting....Take a look and then e-slap
me...
*****
<%

Mode = request.form("mode")
Name = request.form("name")
Shift = request.form("shift")
Wave = request.form("wave")
Carton = request.form("carton")
Location = request.form("location")
License = request.form("license")
Sku = request.form("sku")
Qty = request.form("quantity")
Reason = request.form("reason")
Comments = request.form("comments")
waveyear = request.form("waveyear")
wavemonth = request.form("wavemonth")
waveday = request.form("waveday")
wavenumber = request.form("wavenumber")
entirewave = request.form("waveyear") & request.form("wavemonth") &
request.form("waveday") & request.form("wavenumber")

'************************************************* **************************
** '* DATABASE APPENDING
*
'************************************************* **************************
** 'create db connection
Set dbconn = Server.CreateObject("ADODB.Connection")
dbconn.Mode = adModeReadWrite

'open db in a DSN-less method
dbconn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&
Server.MapPath("/jax/wh/Online_Forms/Secured_Archives/search_files/shortage.
mdb")
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.CursorType = 3
rs.PageSize = 3
rs.open "shortage", dbconn

Do While Not rs.eof
If CLng(entirewave)=Null Then
RecordExists = false
Exit Do
End If
rs.Movenext
Loop
rs.Close

If IsEmpty (Request.QueryString("pageNum")) Then
curPage = 1
Else
curPage = CInt(Request.QueryString("pageNum"))
End If

'create recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

'sql statement to return input values drawn from html fields within
previous week
SQLqry = "SELECT * FROM shortage WHERE wave = '"&waveyear& wavemonth&
waveday& wavenumber&"'"

'display results of statement on screen for testing purposes
Response.Write "<h3><b><u>" & (SQLqry) & "</u></b></h3><br>"

rs.Open SQLqry

rs.AbsolutePage = curPage
Response.Write "<p>You are on page: " & curPage & " of " &
rs.PageCount
Response.Write "<br>"
Response.Write "<br>"

For i = 1 to rs.PageSize
If rs.EOF Then Exit For
Response.Write "<b>Name :</b> " & rs("name")
Response.Write "<br>"
Response.Write "<b>Shift :</b> " & rs("shift")
Response.Write "<br>"
Response.Write "<b>Wave Number :</b> " & rs("wave")
Response.Write "<br>"
Response.Write "<b>Carton Number :</b> " & rs("carton")
Response.Write "<br>"
Response.Write "<b>Location :</b> " & rs("location")
Response.Write "<br>"
Response.Write "<b>License :</b> " & rs("license")
Response.Write "<br>"
Response.Write "<b>SKU :</b> " & rs("sku")
Response.Write "<br>"
Response.Write "<b>Quantity :</b> " & rs("qty")
Response.Write "<br>"
Response.Write "<b>Reason :</b> " & rs("reason")
Response.Write "<br>"
Response.Write "<b>Comments :</b> " & rs("comments")
Response.Write "<br>"
Response.Write "<b>Date Submitted :</b> " & rs("date")
Response.Write "<hr>"
rs.MoveNext
Next
If curPage > 1 then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage-1 & "'>Previous</a>"
If curPage < rs.PageCount then
Response.Write " | "
end if
end if
If curPage < rs.PageCount then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage+1 & "'>Next</a>"
end if

'close recordset
rs.Close

'zero out recordset object
Set rs = Nothing

'smack around the db connection until it lets go
dbconn.Close

'terminate db connection with extreme prejudice
set dbconn = nothing
%>

*****
"Steven Burn" <pv*@noyb.com> wrote in message

news:<#1**************@TK2MSFTNGP09.phx.gbl>...
'// Replace the_database.mdb with the filename of your database
Const objDB = "the_Database.mdb"

Function ConnectToDB(dbPath)
'// The code you use to connect to your database goes here
Set DB = Server.Createobject("ADODB.Connection")
DB.Mode = adModeReadWrite
DB.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" +
Server.MapPath(dbPath))
Set ConnectToDB = DB
End Function

Function RecordExists(sID)
Set DB = ConnectToDB(objDB)
Set rst = Server.CreateObject("ADODB.Recordset")
rst.open "Select ID from tblSomeTable", DB, adOpenStatic, adLockReadOnly
Do While Not rst.eof
If CLng(rst("ID"))=CLng(sID) Then
RecordExists = true
Exit Do
End If
rst.Movenext
Loop
End Function

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
How exactly can I go about doing that? I mean what is the syntax for
that option? I've been playing around with If statements and "Do Until
rs.EOF" statements and I keep breaking it....Things work great if the
data is found but if the string that is being searched for is not
found, it crashes...

"Steven Burn" <pv*@noyb.com> wrote in message

news:<ev**************@TK2MSFTNGP12.phx.gbl>...
> The error you mentioned means the record thats been requested does not
exist
> in the database.
>
> All I do to get past this is use a function that queries the
database for
> the record # thats requested, and re-dir to a friendly "stop

requesting > invalid records" page ;o)
>
> --
>
> Regards
>
> Steven Burn
> Ur I.T. Mate Group
> www.it-mate.co.uk
>
> Keeping it FREE!
>
>
> "dmiller23462" <dm**********@yahoo.com> wrote in message
> news:59**************************@posting.google.c om...
> > My brain is nuked....Can anybody tell me right off the bat what is
> > wrong with this code? Along with any glaring errors, please let me
> > know the syntax to display a message (Response.Write would be fine I > > think) that will say "I'm sorry but the data you requested cannot be > > found" or something along those lines....
> >
> > This code is on an archive page I have on my company's intranet....The > > end result is to show 3 records at a time pulled from an Access DB and > > display on the screen....If the information IS found, everything seems > > to work alright but if it's not I get the error msg listed....Instead > > of that error msg I'd like to get the friendly message for the user > > basically saying "Sorry but your info can't be found" (see
> > above)....Any help/suggestions would be great....I'm fried....In the > > process of trying to improve my work I broke it....I'm a newbie to ASP > > so please, hook a brother up with some advice...
> >
> > My error message....
> > *****
> > ADODB.Recordset error '800a0bcd'
> >
> > Either BOF or EOF is True, or the current record has been deleted.
> > Requested operation requires a current record.
> >
> >
>

/jax/wh/Online_Forms/Secured_Archives/search_files/search_results_wave.asp,
> > line 57
> > *****
> >
> > My code from search_results_wave.asp....
> > *****
> > <!-- #INCLUDE VIRTUAL="/_borders/top_nav.asp" -->
> >
> > <%
> >
> > Mode = request.form("mode")
> > Name = request.form("name")
> > Shift = request.form("shift")
> > Wave = request.form("wave")
> > Carton = request.form("carton")
> > Location = request.form("location")
> > License = request.form("license")
> > Sku = request.form("sku")
> > Qty = request.form("quantity")
> > Reason = request.form("reason")
> > Comments = request.form("comments")
> > waveyear = request.form("waveyear")
> > wavemonth = request.form("wavemonth")
> > waveday = request.form("waveday")
> > wavenumber = request.form("wavenumber")
> >
> >
>

'************************************************* **************************
> **
> > '* DATABASE APPENDING
> > *
> >
>

'************************************************* **************************
> **
> > If IsEmpty (Request.QueryString("pageNum")) Then
> > curPage = 1
> > Else
> > curPage = CInt(Request.QueryString("pageNum"))
> > End If
> >
> > 'create db connection
> > Set dbconn = Server.CreateObject("ADODB.Connection")
> >
> > 'open db in a DSN-less method
> > dbconn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&
> >
>

Server.MapPath("/jax/wh/Online_Forms/Secured_Archives/search_files/shortage.
> mdb")
> >
> > 'create recordset object
> > Set rs = Server.CreateObject("ADODB.Recordset")
> >
> > 'specify more info about rs
> > rs.CursorLocation = 3
> > rs.CursorType = 3
> > rs.PageSize = 3
> > rs.open "shortage", dbconn
> >
> > 'sql statement to return input values drawn from html fields within > > previous week
> > SQLqry = "SELECT * FROM shortage WHERE wave = '"&waveyear& wavemonth& > > waveday& wavenumber&"'"
> >
> > 'display results of statement on screen for testing purposes
> > Response.Write "<h3><b><u>" & (SQLqry) & "</u></b></h3><br>"
> >
> > 'execute SQL statement
> > 'Set db = dbconn.Execute(SQLqry)
> >
> > rs.Close
> > rs.Open SQLqry
> >
> > rs.AbsolutePage = curPage
> > Response.Write "<p>You are on page: " & curPage & " of " &
> > rs.PageCount
> > Response.Write "<br>"
> > Response.Write "<br>"
> >
> > For i = 1 to rs.PageSize
> > If rs.EOF Then Exit For
> > Response.Write "<b>Name :</b> " & rs("name")
> > Response.Write "<br>"
> > Response.Write "<b>Shift :</b> " & rs("shift")
> > Response.Write "<br>"
> > Response.Write "<b>Wave Number :</b> " & rs("wave")
> > Response.Write "<br>"
> > Response.Write "<b>Carton Number :</b> " & rs("carton")
> > Response.Write "<br>"
> > Response.Write "<b>Location :</b> " & rs("location")
> > Response.Write "<br>"
> > Response.Write "<b>License :</b> " & rs("license")
> > Response.Write "<br>"
> > Response.Write "<b>SKU :</b> " & rs("sku")
> > Response.Write "<br>"
> > Response.Write "<b>Quantity :</b> " & rs("qty")
> > Response.Write "<br>"
> > Response.Write "<b>Reason :</b> " & rs("reason")
> > Response.Write "<br>"
> > Response.Write "<b>Comments :</b> " & rs("comments")
> > Response.Write "<br>"
> > Response.Write "<b>Date Submitted :</b> " & rs("date")
> > Response.Write "<hr>"
> > rs.MoveNext
> > Next
> >
> > If curPage > 1 then
> > Response.Write "<a href='search_results_wave.asp?pageNum=" &
> > curPage-1 & "'>Previous</a>"
> > If curPage < rs.PageCount then
> > Response.Write " | "
> > end if
> > end if
> > If curPage < rs.PageCount then
> > Response.Write "<a href='search_results_wave.asp?pageNum=" &
> > curPage+1 & "'>Next</a>"
> > end if
> >
> > 'close recordset
> > rs.Close
> >
> > 'zero out recordset object
> > Set rs = Nothing
> >
> > 'smack around the db connection until it lets go
> > dbconn.Close
> >
> > 'terminate db connection with extreme prejudice
> > set dbconn = nothing
> >
> > %>
> >
> > <br><a href="../Archives.asp">Return to Archives</a>
> > <br><a href="../../Shortage.asp">Return to Shortage Submission
> > Form</a>
> > <br><a href="../../../default.asp">Return to Warehouse
> > Operations</a><!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->
> > *****

Jul 19 '05 #8
Couple references for you ;o)

What is wrong with 'SELECT *'?
http://aspfaq.com/show.asp?id=2096

Why do I get 'BOF or EOF' errors?
http://aspfaq.com/show.asp?id=2246

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
I have inserted my own variables into this code and still no luck....I
kept getting an error message that it an object was
required....Tracking it down to the line containing "rs.Open SQLqry" I
think it's because my first mention of the recordset variable "rs" is
within the "Function RecordExists(sID)" code...I've tried opening and
closing it OUTSIDE of the function and it's not working....Once again,
I'm a bit frazzled (still new to me) and this is the code I currently
have...

I took the code OUTSIDE of the function....Probably not a good idea
but that was part of my experimenting....Take a look and then e-slap
me...
*****
<%

Mode = request.form("mode")
Name = request.form("name")
Shift = request.form("shift")
Wave = request.form("wave")
Carton = request.form("carton")
Location = request.form("location")
License = request.form("license")
Sku = request.form("sku")
Qty = request.form("quantity")
Reason = request.form("reason")
Comments = request.form("comments")
waveyear = request.form("waveyear")
wavemonth = request.form("wavemonth")
waveday = request.form("waveday")
wavenumber = request.form("wavenumber")
entirewave = request.form("waveyear") & request.form("wavemonth") &
request.form("waveday") & request.form("wavenumber")

'************************************************* **************************
** '* DATABASE APPENDING
*
'************************************************* **************************
** 'create db connection
Set dbconn = Server.CreateObject("ADODB.Connection")
dbconn.Mode = adModeReadWrite

'open db in a DSN-less method
dbconn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&
Server.MapPath("/jax/wh/Online_Forms/Secured_Archives/search_files/shortage.
mdb")
Set rs = Server.CreateObject("ADODB.Recordset")
rs.CursorLocation = 3
rs.CursorType = 3
rs.PageSize = 3
rs.open "shortage", dbconn

Do While Not rs.eof
If CLng(entirewave)=Null Then
RecordExists = false
Exit Do
End If
rs.Movenext
Loop
rs.Close

If IsEmpty (Request.QueryString("pageNum")) Then
curPage = 1
Else
curPage = CInt(Request.QueryString("pageNum"))
End If

'create recordset object
Set rs = Server.CreateObject("ADODB.Recordset")

'sql statement to return input values drawn from html fields within
previous week
SQLqry = "SELECT * FROM shortage WHERE wave = '"&waveyear& wavemonth&
waveday& wavenumber&"'"

'display results of statement on screen for testing purposes
Response.Write "<h3><b><u>" & (SQLqry) & "</u></b></h3><br>"

rs.Open SQLqry

rs.AbsolutePage = curPage
Response.Write "<p>You are on page: " & curPage & " of " &
rs.PageCount
Response.Write "<br>"
Response.Write "<br>"

For i = 1 to rs.PageSize
If rs.EOF Then Exit For
Response.Write "<b>Name :</b> " & rs("name")
Response.Write "<br>"
Response.Write "<b>Shift :</b> " & rs("shift")
Response.Write "<br>"
Response.Write "<b>Wave Number :</b> " & rs("wave")
Response.Write "<br>"
Response.Write "<b>Carton Number :</b> " & rs("carton")
Response.Write "<br>"
Response.Write "<b>Location :</b> " & rs("location")
Response.Write "<br>"
Response.Write "<b>License :</b> " & rs("license")
Response.Write "<br>"
Response.Write "<b>SKU :</b> " & rs("sku")
Response.Write "<br>"
Response.Write "<b>Quantity :</b> " & rs("qty")
Response.Write "<br>"
Response.Write "<b>Reason :</b> " & rs("reason")
Response.Write "<br>"
Response.Write "<b>Comments :</b> " & rs("comments")
Response.Write "<br>"
Response.Write "<b>Date Submitted :</b> " & rs("date")
Response.Write "<hr>"
rs.MoveNext
Next
If curPage > 1 then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage-1 & "'>Previous</a>"
If curPage < rs.PageCount then
Response.Write " | "
end if
end if
If curPage < rs.PageCount then
Response.Write "<a href='search_results_wave.asp?pageNum=" &
curPage+1 & "'>Next</a>"
end if

'close recordset
rs.Close

'zero out recordset object
Set rs = Nothing

'smack around the db connection until it lets go
dbconn.Close

'terminate db connection with extreme prejudice
set dbconn = nothing
%>

*****
"Steven Burn" <pv*@noyb.com> wrote in message

news:<#1**************@TK2MSFTNGP09.phx.gbl>...
'// Replace the_database.mdb with the filename of your database
Const objDB = "the_Database.mdb"

Function ConnectToDB(dbPath)
'// The code you use to connect to your database goes here
Set DB = Server.Createobject("ADODB.Connection")
DB.Mode = adModeReadWrite
DB.Open ("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=" +
Server.MapPath(dbPath))
Set ConnectToDB = DB
End Function

Function RecordExists(sID)
Set DB = ConnectToDB(objDB)
Set rst = Server.CreateObject("ADODB.Recordset")
rst.open "Select ID from tblSomeTable", DB, adOpenStatic, adLockReadOnly
Do While Not rst.eof
If CLng(rst("ID"))=CLng(sID) Then
RecordExists = true
Exit Do
End If
rst.Movenext
Loop
End Function

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"dmiller23462" <dm**********@yahoo.com> wrote in message
news:59**************************@posting.google.c om...
How exactly can I go about doing that? I mean what is the syntax for
that option? I've been playing around with If statements and "Do Until
rs.EOF" statements and I keep breaking it....Things work great if the
data is found but if the string that is being searched for is not
found, it crashes...

"Steven Burn" <pv*@noyb.com> wrote in message

news:<ev**************@TK2MSFTNGP12.phx.gbl>...
> The error you mentioned means the record thats been requested does not
exist
> in the database.
>
> All I do to get past this is use a function that queries the
database for
> the record # thats requested, and re-dir to a friendly "stop

requesting > invalid records" page ;o)
>
> --
>
> Regards
>
> Steven Burn
> Ur I.T. Mate Group
> www.it-mate.co.uk
>
> Keeping it FREE!
>
>
> "dmiller23462" <dm**********@yahoo.com> wrote in message
> news:59**************************@posting.google.c om...
> > My brain is nuked....Can anybody tell me right off the bat what is
> > wrong with this code? Along with any glaring errors, please let me
> > know the syntax to display a message (Response.Write would be fine I > > think) that will say "I'm sorry but the data you requested cannot be > > found" or something along those lines....
> >
> > This code is on an archive page I have on my company's intranet....The > > end result is to show 3 records at a time pulled from an Access DB and > > display on the screen....If the information IS found, everything seems > > to work alright but if it's not I get the error msg listed....Instead > > of that error msg I'd like to get the friendly message for the user > > basically saying "Sorry but your info can't be found" (see
> > above)....Any help/suggestions would be great....I'm fried....In the > > process of trying to improve my work I broke it....I'm a newbie to ASP > > so please, hook a brother up with some advice...
> >
> > My error message....
> > *****
> > ADODB.Recordset error '800a0bcd'
> >
> > Either BOF or EOF is True, or the current record has been deleted.
> > Requested operation requires a current record.
> >
> >
>

/jax/wh/Online_Forms/Secured_Archives/search_files/search_results_wave.asp,
> > line 57
> > *****
> >
> > My code from search_results_wave.asp....
> > *****
> > <!-- #INCLUDE VIRTUAL="/_borders/top_nav.asp" -->
> >
> > <%
> >
> > Mode = request.form("mode")
> > Name = request.form("name")
> > Shift = request.form("shift")
> > Wave = request.form("wave")
> > Carton = request.form("carton")
> > Location = request.form("location")
> > License = request.form("license")
> > Sku = request.form("sku")
> > Qty = request.form("quantity")
> > Reason = request.form("reason")
> > Comments = request.form("comments")
> > waveyear = request.form("waveyear")
> > wavemonth = request.form("wavemonth")
> > waveday = request.form("waveday")
> > wavenumber = request.form("wavenumber")
> >
> >
>

'************************************************* **************************
> **
> > '* DATABASE APPENDING
> > *
> >
>

'************************************************* **************************
> **
> > If IsEmpty (Request.QueryString("pageNum")) Then
> > curPage = 1
> > Else
> > curPage = CInt(Request.QueryString("pageNum"))
> > End If
> >
> > 'create db connection
> > Set dbconn = Server.CreateObject("ADODB.Connection")
> >
> > 'open db in a DSN-less method
> > dbconn.Open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE="&
> >
>

Server.MapPath("/jax/wh/Online_Forms/Secured_Archives/search_files/shortage.
> mdb")
> >
> > 'create recordset object
> > Set rs = Server.CreateObject("ADODB.Recordset")
> >
> > 'specify more info about rs
> > rs.CursorLocation = 3
> > rs.CursorType = 3
> > rs.PageSize = 3
> > rs.open "shortage", dbconn
> >
> > 'sql statement to return input values drawn from html fields within > > previous week
> > SQLqry = "SELECT * FROM shortage WHERE wave = '"&waveyear& wavemonth& > > waveday& wavenumber&"'"
> >
> > 'display results of statement on screen for testing purposes
> > Response.Write "<h3><b><u>" & (SQLqry) & "</u></b></h3><br>"
> >
> > 'execute SQL statement
> > 'Set db = dbconn.Execute(SQLqry)
> >
> > rs.Close
> > rs.Open SQLqry
> >
> > rs.AbsolutePage = curPage
> > Response.Write "<p>You are on page: " & curPage & " of " &
> > rs.PageCount
> > Response.Write "<br>"
> > Response.Write "<br>"
> >
> > For i = 1 to rs.PageSize
> > If rs.EOF Then Exit For
> > Response.Write "<b>Name :</b> " & rs("name")
> > Response.Write "<br>"
> > Response.Write "<b>Shift :</b> " & rs("shift")
> > Response.Write "<br>"
> > Response.Write "<b>Wave Number :</b> " & rs("wave")
> > Response.Write "<br>"
> > Response.Write "<b>Carton Number :</b> " & rs("carton")
> > Response.Write "<br>"
> > Response.Write "<b>Location :</b> " & rs("location")
> > Response.Write "<br>"
> > Response.Write "<b>License :</b> " & rs("license")
> > Response.Write "<br>"
> > Response.Write "<b>SKU :</b> " & rs("sku")
> > Response.Write "<br>"
> > Response.Write "<b>Quantity :</b> " & rs("qty")
> > Response.Write "<br>"
> > Response.Write "<b>Reason :</b> " & rs("reason")
> > Response.Write "<br>"
> > Response.Write "<b>Comments :</b> " & rs("comments")
> > Response.Write "<br>"
> > Response.Write "<b>Date Submitted :</b> " & rs("date")
> > Response.Write "<hr>"
> > rs.MoveNext
> > Next
> >
> > If curPage > 1 then
> > Response.Write "<a href='search_results_wave.asp?pageNum=" &
> > curPage-1 & "'>Previous</a>"
> > If curPage < rs.PageCount then
> > Response.Write " | "
> > end if
> > end if
> > If curPage < rs.PageCount then
> > Response.Write "<a href='search_results_wave.asp?pageNum=" &
> > curPage+1 & "'>Next</a>"
> > end if
> >
> > 'close recordset
> > rs.Close
> >
> > 'zero out recordset object
> > Set rs = Nothing
> >
> > 'smack around the db connection until it lets go
> > dbconn.Close
> >
> > 'terminate db connection with extreme prejudice
> > set dbconn = nothing
> >
> > %>
> >
> > <br><a href="../Archives.asp">Return to Archives</a>
> > <br><a href="../../Shortage.asp">Return to Shortage Submission
> > Form</a>
> > <br><a href="../../../default.asp">Return to Warehouse
> > Operations</a><!-- #INCLUDE VIRTUAL="/_borders/bottom_nav.asp" -->
> > *****

Jul 19 '05 #9

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

Similar topics

1
by: Anand | last post by:
Hi i am having trouble adding a recordset into the access database, the code seems to be working fine it passs and parses through all variables just fine without showing any errors and also when i...
23
by: Rob Meade | last post by:
Lo all, Ok - this is what I was aiming to do, and then I thought - naahhh, that cant be right! query database results to recordset results to array using GetRows update values in one column...
7
by: Paul | last post by:
I thought this is more of an IE issue but i've had no joy on that group perhaps somebody here will have a clue. If i click a link to a web page embedded in Excel (97 OR 2000) i get the standard...
4
by: Tom | last post by:
I want to open a recordset object on an .asp page. When I open the recordset I would like to use a stored procedure that expects a parameter to be passed for the stored procedure. I will then use...
13
by: shank | last post by:
How do you return the highest value in a recordset of maybe 100 records? Is it necessary to run 2 recordsets? I was hoping it was as simple as Max(), but no luck. thanks
10
by: Douglas Buchanan | last post by:
I am using the following code instead of a very lengthly select case statement. (I have a lot of lookup tables in a settings form that are selected from a ListBox. The data adapters are given a...
27
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is...
3
by: Nathan Bloomfield | last post by:
Hi there, I am having difficulty with a piece of code which would work wonders for my application if only the error trapping worked properly. Basically, it works as follows: - adds records...
2
by: louis | last post by:
I often read a recordset (ADO) into a variant array so that the array can contain text, currency, boolean, etc. VB.Net does not allow variants and the object type gives errors during conversion...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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.