[thelist] ASP Query Issue
My Mailing List
my.mailing.lists at gmail.com
Sat Jul 15 14:27:21 CDT 2006
I'm at my wits end right now...every time I try to run a query through my
ASP page, it fails to find any matching records...but when I output the SQL
and the put it directly into MS Access, it works perfect.
This is the query:
SELECT * FROM [Search_Words] WHERE TRIM([Word]) = 'kidspiration'
I'll post the entire page below...but this is the query that's being the
pain.
Any ideas/suggestions would be greatly appreciated.
Thanks,
Scott
PS. the connection string/variables are included via the top.asp file. the
connection string looks like this:
path = server.mappath("../../db/gwt-data.mdb")
strCOnn = "Provider= Microsoft.Jet.OLEDB.4.0;Data Source=" & path &
";"
====================================================================
<%server.ScriptTimeout = 999999%>
<!--#include file=" top.asp"-->
<%
sub go(r, z, g)
for x = lbound(r,1) to ubound(r,1)
w = trim(replace(r(x), " ", ""))
if len(w) > 1 then
SQL = "SELECT * FROM [Search_Words] WHERE TRIM([Word]) = '" &
lcase(w) & "'"
response.write sql & "<BR>"
set rs2 = objConn.execute(SQL)
if not rs.eof then
response.write len(w) & "-" & w & "-1<br>"
'SQL = "INSERT INTO [Search_Matches](WordID, ItemID, Title)
VALUES(" & rs2("wordid") & ", " & g & ", " & z & ")"
'objConn.execute(SQL)
else
response.write len(w) & "-" & w & "-2<br>"
SQL = "INSERT INTO [Search_Words](Word) VALUES('" & w & "')"
objConn.execute(SQL)
'SQL = "SELECT @@IDENTITY as T FROM [Search_Words]"
'set rs3 = objConn.execute(SQL)
'z = rs3("t")
'rs3.close
'set rs3 = nothing
'SQL = "INSERT INTO [Search_Matches](WordID, ItemID, Title)
VALUES(" & z & ", " & g & ", " & z & ")"
'objConn.execute(SQL)
end if
end if
next
end sub
call openDB(objConn)
function prep(str)
prep = str
p = "~i!i at i#i$i%i^i&i*i(i)i_i+i=i-i`i[i]i\i{i}i|i;i'i:i""i, i.i
/i<i>i?i1i2i3i4i5i6i7i8i9i0i�"
parr = split(p, "i")
if len(prep) <> 0 then
prep = replace(prep, vbCrLf, " ")
prep = replace(prep, vbCr, " ")
prep = replace(prep, vbLf, " ")
for q = lbound(parr,1) to ubound(parr,1)
prep = replace(prep, parr(q), " ")
next
end if
prep = lcase(prep)
end function
SQL = "SELECT top 3 * FROM [Software-Titles]"
set rs = objConn.execute(SQL)
if not rs.eof then
arr = rs.getrows()
for i = lbound(arr,2) to ubound(arr,2)
t = prep(arr(2,i))
e = prep(arr(3,i))
d = prep(arr(4,i))
ta = split(t, " ")
ea = split(e, " ")
da = split(d, " ")
g = arr(0,i)
r = ta
z = 1
call go(r, z, g)
r = ea
z = 0
call go(r, z, g)
r = da
z = 0
call go(r, z, g)
next
end if
rs.close
set rs = nothing
call closeDB(objConn)
%>
<!--#include file="bottom.asp"-->
More information about the thelist
mailing list