[thelist] ASP Query Issue

Ken Schaefer Ken at adOpenStatic.com
Sun Jul 16 02:43:59 CDT 2006


Hi,


:             set rs2 = objConn.execute(SQL)
: 
:             if not rs.eof then
:                 response.write len(w) & "-" & w & "-1<br>"

rs2 appears to hold the results of your query.

Immediately afterwards you check to see if rs holds any records. Are you sure
that's what you want to do?

Cheers
Ken

--
My IIS Blog: www.adOpenStatic.com/cs/blogs/ken
Tech.Ed Sydney: learn all about IIS 7.0 - See you there!


: -----Original Message-----
: From: thelist-bounces at lists.evolt.org [mailto:thelist-
: bounces at lists.evolt.org] On Behalf Of My Mailing List
: Sent: Sunday, 16 July 2006 5:27 AM
: To: thelist
: Subject: [thelist] ASP Query Issue
: 
: 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"-->
: --
: 
: * * Please support the community that supports you.  * *
: http://evolt.org/help_support_evolt/
: 
: For unsubscribe and other options, including the Tip Harvester
: and archives of thelist go to: http://lists.evolt.org
: Workers of the Web, evolt !


More information about the thelist mailing list