Passing Variables from Hyperlink to SQL in FrontPa

Results 1 to 3 of 3

Thread: Passing Variables from Hyperlink to SQL in FrontPa

  1. #1
    Kelly Wong Guest

    Default Passing Variables from Hyperlink to SQL in FrontPa

    I am a newbie with a question on passing variables into an SQL statement in an ASP page. I don’t know if it matters but I am using FrontPage98 and Access97. <BR><BR>I am trying to send the variables from a hyperlink in another ASP page. Since the hyperlink will be dynamically created as well, I don’t want to use a form. (I have gotten the form version of this to work)<BR><BR>Here is the HTML code from the sending page.<BR><BR>&#060;p&#062;&#060;a href="Scripts/authors1.asp?Author=Brown, Sandra"&#062;Brown, Sandra&#060;/a&#062;&#060;/p&#062;<BR><BR>Here is the code I put in the top of my ASP page using the Script Wizard.<BR><BR>&#060;h2&#062;&#060;% Author = request.querystring("Author") %&#062; &#060;/h2&#062;<BR><BR><BR>I think the problem lies somewhere in the DataBase Region Properties SQL statement. This is the code I put in the box:<BR><BR>SELECT RGAuthors.HPHyper<BR>FROM RGAuthors<BR>WHERE RGAuthors.Author= & &#060;%=Author%&#062;<BR><BR>Here is the code FrontPage generated for my SQL statement.<BR><BR>fp_sQry = "SELECT RGAuthors.HPHyper FROM RGAuthors WHERE RGAuthors.Author= & &#060;%=Author%&#062;"<BR><BR>I know this isn’t correct. That somehow I need to parse in the variable, but how do I do that in the Data Base Region box? If I try to type over the results in the HTML page, they are overwritten. Can somebody tell me what I am doing wrong?<BR><BR>Thanks in advance!!<BR><BR>Kelly<BR>

  2. #2
    Tim Wong Guest

    Default RE: Passing Variables from Hyperlink to SQL in Fro

    It is easy to forget that SQL statements need to have quotes around text variables (so, a single quote after the equal sign and one at the very end).

  3. #3
    Join Date
    Dec 1969
    Posts
    94

    Default RE: Passing Variables from Hyperlink to SQL in Fro

    This is what I think will do it, since your sql statement is in the asp script then:<BR><BR>fp_sQry = "SELECT RGAuthors.HPHyper FROM RGAuthors WHERE RGAuthors.Author=&#039" & Author & "&#039"<BR><BR>Remember that text has to be surrounded by single quotes.

Posting Permissions

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