4Wheels
08-26-2011, 04:31 PM
hi,
i'm having issues with a classic asp database and script. i had already uploaded my second post about it a couple days ago (which contained all the code). now i can't find it in this forum anywhere so i'll upload it again with this post.
so far i (with help from here) discovered that the select statement is not working correctly because both "common_name" and "group_nbr" are both null. looking at the table, the data is there! when i print the select statement out with response.write it looks like this:
SELECT count(*) as plantcnt FROM intro WHERE ready=true and Instr(common_name, '1')=0 and group_nbr<17
what i'm essentially doing for this first recordset is INCLUDING any records that DON'T contain a "1" in the first position of common_name, and any records that contain a group_nbr of 17 or over. do you see anything wrong with the connectionstring or select statement?
this whole site worked perfect 6 years ago. pretty good lessen on how things can change. i had expected to have to change some HTML since those requirements have changed now (html 4?). but simple things like this get frustrating! i started out to learn asp.net 4, not fix old asp 3.
let me know if you need to see the fields in the "intro" table... group_nbr is number.
question: does "SELECT count(*) as plantcnt" create a field named plantcnt that has sums in it? (my brain is foggy...haven't looked at this or much other code for 6+ years!)
================================================== =======================
this is the error msg:
----------------------
Microsoft JET Database Engine error '80040e10'
No value given for one or more required parameters.
/index.asp, line 31
================================================== =======================
this is index.asp from the top line to the closing head tag.
------------------------------------------------------------
[code]
<!-- #INCLUDE FILE="content.asp" -->
<!doctype html public "-//w3C//dtd html 4.0 transitional//en">
<html><head><title>Successful Houseplants - growing and buying tips</title>
<meta name="description" content="Be successful with plants! Read interesting facts, buying and 'Plant Doctor' tips
for many exciting plants. Also has links to nurseries to buy plants, books, and supplies." />
<meta name="keywords" content="" />
<link rel="stylesheet" href="plants.css" type="text/css" />
<%
Response.Expires = 60
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
if Session("Logout") <> "yes" then
if Request.Cookies("SavedLogin").haskeys then
Session("PersonID")=Request.Cookies("SavedLogin")("personid")
Session("Username")=Request.Cookies("SavedLogin")("username")
Session("Password")=Request.Cookies("SavedLogin")("pw")
Session("blnValidUser") = true
end if
end if
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath
set rsIntro = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT count(*) as plantcnt FROM intro " & _
"WHERE ready=true and Instr(common_name, '1')=0 and group_nbr<17 "
[\code]
***************** line 31 below throws the error *****************
[code]
rsIntro.Open strSQL, objConn
[\code]
************************************************** ****************
[code]
if not rsIntro.EOF then
dim intTotPlants
intTotPlants=rsIntro("plantcnt")
end if
rsIntro.Close
strSQL = "SELECT count(*) as tipscnt FROM intro WHERE ready=true and Instr(common_name, '1')=1 or group_nbr>16"
rsIntro.Open strSQL, objConn
if not rsIntro.EOF then
dim int
intTotTips=rsIntro("tipscnt")
end if
set rsIntro = nothing
set objConn = nothing
%>
[\code]
================================================== =========================
i declare these and more in content.asp (the include file)
----------------------------------------------------------
[code]
dim filePath, objConn
filePath = Server.MapPath("\db\plants.mdb")
dim filePath2, objConn2
filePath2 = Server.MapPath("\db\promotions.mdb")
dim filePath3, objConn3
filePath3 = Server.MapPath("\db\vars.mdb")
dim strSQL
strSQL=""
[\code]
i'm having issues with a classic asp database and script. i had already uploaded my second post about it a couple days ago (which contained all the code). now i can't find it in this forum anywhere so i'll upload it again with this post.
so far i (with help from here) discovered that the select statement is not working correctly because both "common_name" and "group_nbr" are both null. looking at the table, the data is there! when i print the select statement out with response.write it looks like this:
SELECT count(*) as plantcnt FROM intro WHERE ready=true and Instr(common_name, '1')=0 and group_nbr<17
what i'm essentially doing for this first recordset is INCLUDING any records that DON'T contain a "1" in the first position of common_name, and any records that contain a group_nbr of 17 or over. do you see anything wrong with the connectionstring or select statement?
this whole site worked perfect 6 years ago. pretty good lessen on how things can change. i had expected to have to change some HTML since those requirements have changed now (html 4?). but simple things like this get frustrating! i started out to learn asp.net 4, not fix old asp 3.
let me know if you need to see the fields in the "intro" table... group_nbr is number.
question: does "SELECT count(*) as plantcnt" create a field named plantcnt that has sums in it? (my brain is foggy...haven't looked at this or much other code for 6+ years!)
================================================== =======================
this is the error msg:
----------------------
Microsoft JET Database Engine error '80040e10'
No value given for one or more required parameters.
/index.asp, line 31
================================================== =======================
this is index.asp from the top line to the closing head tag.
------------------------------------------------------------
[code]
<!-- #INCLUDE FILE="content.asp" -->
<!doctype html public "-//w3C//dtd html 4.0 transitional//en">
<html><head><title>Successful Houseplants - growing and buying tips</title>
<meta name="description" content="Be successful with plants! Read interesting facts, buying and 'Plant Doctor' tips
for many exciting plants. Also has links to nurseries to buy plants, books, and supplies." />
<meta name="keywords" content="" />
<link rel="stylesheet" href="plants.css" type="text/css" />
<%
Response.Expires = 60
Response.ExpiresAbsolute = Now() - 1
Response.AddHeader "pragma","no-cache"
Response.AddHeader "cache-control","private"
Response.CacheControl = "no-cache"
if Session("Logout") <> "yes" then
if Request.Cookies("SavedLogin").haskeys then
Session("PersonID")=Request.Cookies("SavedLogin")("personid")
Session("Username")=Request.Cookies("SavedLogin")("username")
Session("Password")=Request.Cookies("SavedLogin")("pw")
Session("blnValidUser") = true
end if
end if
set objConn = Server.CreateObject("ADODB.Connection")
objConn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filePath
set rsIntro = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT count(*) as plantcnt FROM intro " & _
"WHERE ready=true and Instr(common_name, '1')=0 and group_nbr<17 "
[\code]
***************** line 31 below throws the error *****************
[code]
rsIntro.Open strSQL, objConn
[\code]
************************************************** ****************
[code]
if not rsIntro.EOF then
dim intTotPlants
intTotPlants=rsIntro("plantcnt")
end if
rsIntro.Close
strSQL = "SELECT count(*) as tipscnt FROM intro WHERE ready=true and Instr(common_name, '1')=1 or group_nbr>16"
rsIntro.Open strSQL, objConn
if not rsIntro.EOF then
dim int
intTotTips=rsIntro("tipscnt")
end if
set rsIntro = nothing
set objConn = nothing
%>
[\code]
================================================== =========================
i declare these and more in content.asp (the include file)
----------------------------------------------------------
[code]
dim filePath, objConn
filePath = Server.MapPath("\db\plants.mdb")
dim filePath2, objConn2
filePath2 = Server.MapPath("\db\promotions.mdb")
dim filePath3, objConn3
filePath3 = Server.MapPath("\db\vars.mdb")
dim strSQL
strSQL=""
[\code]