Wrox Home  
Search P2P Archive for: Go

  Return to Index  

access_asp thread: Command text was not set for the command object ...


Message #1 by "Burak Balibey" <burak@g...> on Mon, 4 Feb 2002 01:35:18
My Code is Like That ... What May Be The Problem ...





<%

Dim RecordCount

Dim SqlQuery

Set Conn=Server.CreateObject("ADODB.Connection")

Conn.Open "NuvisDATA"

Dim Counter

Counter = Request.Form("Ara_KitapAdi")

Select Case Counter

	Case Counter<>""

	If trim(Request.Form("Ara_KitapAdi"))<>"" and trim(Request.Form

("Ara_Kategori"))<>"" then SqlQuery="Select * from Kutuphane WHERE 

(((Name) Like '%" & trim(Request.Form("Ara_KitapAdi")) & "%')) OR 

(((Category) = '" & trim(Request.Form("Ara_Kategori")) & "'));"

	If trim(Request.Form("Ara_KitapAdi"))<>"" and trim(Request.Form

("Ara_Kategori"))="" then SqlQuery="Select * from Kutuphane Where Name 

like '%"& trim(Request.Form("Ara_KitapAdi"))&"%' ;"

	If trim(Request.Form("Ara_KitapAdi"))="" and trim(Request.Form

("Ara_Kategori"))<>"" then SqlQuery="Select * from Kutuphane Where 

Category='"&trim(Request.Form("Ara_Kategori"))&"';"



	Case Counter=""

	If trim(Request.Form("Ara_KitapAdi"))="" and trim(Request.Form

("Ara_Kategori"))<>""  then SqlQuery="Select * from Kutuphane WHERE 

(((Category) = '" & trim(Request.Form("Ara_Kategori")) & "')) OR (((Yazar) 

Like '%" & trim(Request.Form("Ara_YazarAdi")) & "%'));"

	If trim(Request.Form("Ara_KitapAdi"))<>"" and trim(Request.Form

("Ara_Kategori"))<>"" then SqlQuery="Select * from Kutuphane WHERE 

(((Name) Like '%" & trim(Request.Form("Ara_KitapAdi")) & "%')) OR 

(((Category) = '" & trim(Request.Form("Ara_Kategori")) & "')) OR (((Yazar) 

Like '%" & trim(Request.Form("Ara_YazarAdi")) & "%'));"

	If trim(Request.Form("Ara_KitapAdi"))="" and trim(Request.Form

("Ara_Kategori"))="" then SqlQuery="Select * from Kutuphane Where 

Category='"& trim(Request.Form("Ara_Kategori"))&"';"

	If trim(Request.Form("Ara_KitapAdi"))<>"" and trim(Request.Form

("Ara_Kategori"))="" then SqlQuery="Select * from Kutuphane Where Name 

like '%"& trim(Request.Form("Ara_KitapAdi"))&"%' ;"

End Select

Set Recordset = Conn.Execute (SqlQuery)

%>
Message #2 by "Ken Schaefer" <ken@a...> on Mon, 4 Feb 2002 13:47:30 +1100
After each Case statement put:



Response.Write("This is case 1")



and see where your code is falling to. I suspect that it is falling nowhere.

Your code should read something like:



<%

Select Case Counter

Case ""

    ...

Case Else

    ...

End Select

%>



Cheers

Ken



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

From: "Burak Balibey" <burak@g...>

Subject: [access_asp] Command text was not set for the command object ...





: My Code is Like That ... What May Be The Problem ...

:

:

: <%

: Dim RecordCount

: Dim SqlQuery

: Set Conn=Server.CreateObject("ADODB.Connection")

: Conn.Open "NuvisDATA"

: Dim Counter

: Counter = Request.Form("Ara_KitapAdi")

: Select Case Counter

: Case Counter<>""

: If trim(Request.Form("Ara_KitapAdi"))<>"" and trim(Request.Form

: ("Ara_Kategori"))<>"" then SqlQuery="Select * from Kutuphane WHERE

: (((Name) Like '%" & trim(Request.Form("Ara_KitapAdi")) & "%')) OR

: (((Category) = '" & trim(Request.Form("Ara_Kategori")) & "'));"

: If trim(Request.Form("Ara_KitapAdi"))<>"" and trim(Request.Form

: ("Ara_Kategori"))="" then SqlQuery="Select * from Kutuphane Where Name

: like '%"& trim(Request.Form("Ara_KitapAdi"))&"%' ;"

: If trim(Request.Form("Ara_KitapAdi"))="" and trim(Request.Form

: ("Ara_Kategori"))<>"" then SqlQuery="Select * from Kutuphane Where

: Category='"&trim(Request.Form("Ara_Kategori"))&"';"

:

: Case Counter=""

: If trim(Request.Form("Ara_KitapAdi"))="" and trim(Request.Form

: ("Ara_Kategori"))<>""  then SqlQuery="Select * from Kutuphane WHERE

: (((Category) = '" & trim(Request.Form("Ara_Kategori")) & "')) OR (((Yazar)

: Like '%" & trim(Request.Form("Ara_YazarAdi")) & "%'));"

: If trim(Request.Form("Ara_KitapAdi"))<>"" and trim(Request.Form

: ("Ara_Kategori"))<>"" then SqlQuery="Select * from Kutuphane WHERE

: (((Name) Like '%" & trim(Request.Form("Ara_KitapAdi")) & "%')) OR

: (((Category) = '" & trim(Request.Form("Ara_Kategori")) & "')) OR (((Yazar)

: Like '%" & trim(Request.Form("Ara_YazarAdi")) & "%'));"

: If trim(Request.Form("Ara_KitapAdi"))="" and trim(Request.Form

: ("Ara_Kategori"))="" then SqlQuery="Select * from Kutuphane Where

: Category='"& trim(Request.Form("Ara_Kategori"))&"';"

: If trim(Request.Form("Ara_KitapAdi"))<>"" and trim(Request.Form

: ("Ara_Kategori"))="" then SqlQuery="Select * from Kutuphane Where Name

: like '%"& trim(Request.Form("Ara_KitapAdi"))&"%' ;"

: End Select

: Set Recordset = Conn.Execute (SqlQuery)

: %>



~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




  Return to Index