Problems with sql script

Results 1 to 2 of 2

Thread: Problems with sql script

  1. #1
    stuvi Guest

    Default Problems with sql script

    This is my sql script that i am using to get data from a access database. It works fines without the WHERE clause, but as soon as include WHERE, it returns no values. I know that there is data that meets that query, so am i declaring the sql script properly? <BR><BR>SELECT [PD_Session].[session_name], [PD_Session].[session_date],[PD_Session].[session_time], [PD_Session].[session_state],[PD_Session].[session_city], [PD_Session].[organisation_name],[PD_Session].[category_name], [Session_Target].[target_market] FROM PD_Session INNER JOIN Session_Target ON [PD_Session].[session_name]=[Session_Target].[session_name] WHERE [PD_Session].[category_name]=&#039category&#039<BR><BR>category is taken from querystring. <BR>ie category=Request("category")<BR>I have also checked that category has a value.<BR><BR>Help would be appreciated. Thank you.

  2. #2
    Eddie Campbell Guest

    Default RE: Problems with sql script

    You are supplying the word category to the query rather than the variable category. Try like this:<BR>"SELECT [PD_Session].[session_name], [PD_Session].[session_date],[PD_Session].[session_time], [PD_Session].[session_state],[PD_Session].[session_city], [PD_Session].[organisation_name],[PD_Session].[category_name], [Session_Target].[target_market] FROM PD_Session INNER JOIN Session_Target ON [PD_Session].[session_name]=[Session_Target].[session_name] WHERE [PD_Session].[category_name]=&#039" & category & "&#039"<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts