[ASP/SQL] Simpel zoekscript

Pagina: 1
Acties:

  • didio
  • Registratie: Maart 2001
  • Laatst online: 01-04 09:19

didio

didio.nl

Topicstarter
Ik word echt helemaal gek, of dat ik nou te lang achter mijn machine zit of dat het komt omdat het zulk lekker weer is.. ik weet het niet meer.

Ik heb een super simpel zoekscriptje gebouwd, als ik die run blijft alles hangen..

Misschien zien jullie er iets in, ik zie het niet meer..

Hier een paar snippets uit mijn Search Class en SQL SP.
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Public Sub Search()
Set objConn = CreateObject("ADODB.Connection")
objConn.Open CONNECTION
Set objCmd = CreateObject("ADODB.Command")
objCmd.ActiveConnection = objConn
objCmd.CommandType = adCmdStoredProc

objCmd.CommandText = "sp_Search"
objCmd.Parameters.Append objCmd.CreateParameter("SearchQuery", adVarchar, adParamInput, 255, m_strSearchQuery)
Set objRec = objCmd.Execute
Set objCmd = Nothing
        
If Not objRec.EOF Then
    Do While Not objRec.EOF
        Response.Write objRec("CategoryName") & "<br>"
    Loop
End If

objRec.Close
Set objRec = Nothing
objConn.Close
Set objConn = Nothing
End Sub

Hier mijn SP die ik anroep..
code:
1
2
3
4
5
6
CREATE PROCEDURE [sp_Search]
    @SearchQuery varchar(255)
AS

SELECT CategoryName FROM tblCategories WHERE CategoryName LIKE '%' + @SearchQuery + '%' OR Keywords LIKE '%' + @SearchQuery + '%'
GO

Dit is het zo'n beetje, de SP werkt want als ik die aanroep in de Query Analyzer werkt het gewoon, ik weet ook al waar het fout gaat, dat is bij: Do While Not objRec.EOF

Zien jullie misschien iets wat ik niet zie?

weinig tot niks..


  • Basszje
  • Registratie: Augustus 2000
  • Laatst online: 11-09 08:17

Basszje

Reisvaap!]

Do while
objrec.movenext
loop

:)

Beware of listening to the imposter; you are undone if you once forget that the fruits of the earth belong to us all, and the earth itself to nobody.


  • didio
  • Registratie: Maart 2001
  • Laatst online: 01-04 09:19

didio

didio.nl

Topicstarter
jezus.. het is gewoon te lekker weer voor dit werk..

Thanks..

weinig tot niks..


  • Basszje
  • Registratie: Augustus 2000
  • Laatst online: 11-09 08:17

Basszje

Reisvaap!]

Ga relaxen dan :P .

Beware of listening to the imposter; you are undone if you once forget that the fruits of the earth belong to us all, and the earth itself to nobody.


  • didio
  • Registratie: Maart 2001
  • Laatst online: 01-04 09:19

didio

didio.nl

Topicstarter
Op maandag 11 maart 2002 15:28 schreef Basszje het volgende:
Ga relaxen dan :P .
Als ik daar tijd voor had had ik het gedaan..

weinig tot niks..


  • Crazy D
  • Registratie: Augustus 2000
  • Laatst online: 12:14

Crazy D

I think we should take a look.

Hmm ik roep een storec proc die alleen input params heeft (en een recordset teruggeeft als resultaat) altijd zo aan:
Set rs = con.Execute("execute spMyStoredProc '" & strVar & "', " & intVar)
En dat werkt gewoon altijd... (alleen moet je wel je loopje goed maken :P)

Exact expert nodig?


  • didio
  • Registratie: Maart 2001
  • Laatst online: 01-04 09:19

didio

didio.nl

Topicstarter
Op dinsdag 12 maart 2002 12:28 schreef Crazy_D het volgende:
Hmm ik roep een storec proc die alleen input params heeft (en een recordset teruggeeft als resultaat) altijd zo aan:
Set rs = con.Execute("execute spMyStoredProc '" & strVar & "', " & intVar)
En dat werkt gewoon altijd... (alleen moet je wel je loopje goed maken :P)
Volgens mij is mijn manier beter :9, op jouw manier moet SQL server raden wat voor een types je parameters zijn.

Ook vind ik mijn manier wat overzichtelijker. Maar dat is een kwestie van smaak.

Bij mij werkt het ook altijd, behalve als ik iets vergeet 8-)

weinig tot niks..

Pagina: 1