RE: Problem passing data via the querystring

Results 1 to 3 of 3

Thread: RE: Problem passing data via the querystring

  1. #1
    Matthew Kirwan Guest

    Default RE: Problem passing data via the querystring

    Hi,<BR><BR>I am having a problem passing data using the querystring.<BR><BR>In my program, the first script creates a table with links in each of the cells. Clicking on a link passes various values to a second script. This includes a location. It works fine when the location is just one word but an error results when it is more than one word as the second script uses the location in an SQL query. What is happening is that the ASCII character for spaces is being inserted into the location name when it is passed via the querystring i.e. the town Yarra Junction becomes<BR>Yarra%20Junction. The SQL query then cannot find a location with the name Yarra%20Junction. Here is the exact error message that is experienced when I click on a link from the first to the second script. I have included diagnostic print statements.<BR><BR>_______________________________ ______________________________<BR><BR>The location string has the value: Yarra%20Junction<BR><BR>The SQL statement becomes consequently: SELECT * FROM PoliceStationRegionDivision WHERE PoliceStation= &#039;Yarra%20Junction&#039;<BR><BR>And the resulting record count is: 0<BR><BR>ADODB Field error &#039;800a0bcd&#039;<BR><BR>Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record.<BR><BR>/Statistics/processing2.asp, line 68<BR><BR>________________________________________ ________________________<BR><BR><BR>Could someone please help.<BR><BR>Regards,<BR><BR>Matthew Kirwan

  2. #2
    Join Date
    Dec 1969

    Default RE: Problem passing data via the querystring

    Hello,<BR><BR>Hmmm -what is your processing script - i.e. the bit that takes the querystring and makes an sql statement? It&#039;s just that I have the same thing at it works. Your SQL would be something like:-<BR><BR>SELECT * FROM PoliceStationRegionDivision WHERE (PoliceStation= &#039;"&request.querystring("link")&"&#039;)"<BR>< BR>This works on an IIS installation.<BR><BR>Let us know a little more....<BR><BR>DC<BR><BR>

  3. #3
    Matthew Kirwan Guest

    Default RE: Problem passing data via the querystring - Mor

    Hi,<BR><BR>Thanks for your reply DC.<BR><BR>Further info:<BR><BR>The querystring as it is displayed in the browser when the second script is executed is:<BR><BR>http://web/Statistics/processing2.asp?25/08/01&Yarra%20Junction&4&3&01&2001&12&2001<BR><BR>Bec ause there are several values passed I use an array to store the values passed by the querystring. Here is the relevant code<BR>segment.<BR><BR>queryStringArray = Split(Request.QueryString, "&")<BR><BR>&#039; Create array to store the components of the first element of the array, the start date of the required station return. <BR>&#039; The date passed via the querystring is of data type string.<BR><BR>dateComponentArray = Split(queryStringArray(0), "/")<BR><BR>&#039; Create start date using the elemnts of the array just created.<BR>&#039; This date will be of data type date<BR><BR>dtStartDate = DateSerial(dateComponentArray(2), dateComponentArray(1), dateComponentArray(0))<BR><BR>&#039; Retrieve the police station of the required station return<BR> <BR>strPoliceStation = queryStringArray(1)<BR><BR>&#039; Query the database for the record of the police station<BR><BR>strSQL = "SELECT * FROM PoliceStationRegionDivision " _<BR> & "WHERE PoliceStation=&#039;" & strPoliceStation & "&#039; "<BR><BR>Kind Regards,<BR><BR>Matthew<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