Creating a Click Through System

Results 1 to 2 of 2

Thread: Creating a Click Through System

  1. #1
    Join Date
    Dec 1969

    Default Creating a Click Through System

    Scott,<BR>There is something wrong with this sript I copied from Part 2 of your article. Basically there is something preventing the End If working but try as I might I cannot find it.<BR><BR>&#060;% Option Explicit %&#062;<BR>&#060;%<BR> &#039;Read in the ID from the querystring<BR> Dim iID<BR> iID = Request.QueryString("ID")<BR> <BR> &#039;If ID is not present, display an error mesage<BR> If Len(iID) = 0 or Not IsNumeric(iID) then<BR> Response.Write "An invalid ID has been passed into trackClicks.asp.<BR>"<BR> Response.Write "[&#060;a href=""/""&#062;Return to;/a&#062;]"<BR> Response.End <BR> Else<BR> &#039;We have a valid ID, update the linkClicks table and get the URL %&#062;&#060;title&#062;Track Click&#060;/title&#062;<BR> Dim objRS, objConn<BR> Set objConn = Server.CreateObject("ADODB.Connection")<BR> objConn.Open "DSN=GardenForum"<BR> <BR> Set objRS = objConn.Execute("SendOffSite " & iID)<BR> <BR> Dim strURL<BR> strURL = objRS(0).Value<BR> <BR> objRS.Close<BR> Set objRS = Nothing<BR> <BR> objConn.Close<BR> Set objConn = Nothing<BR><BR> &#039;Send the user to the URL<BR> Response.Redirect(strURL)<BR> End If<BR>%&#062;

  2. #2
    Join Date
    Dec 1969

    Default RE: Creating a Click Through System

    I think the error lies in the statement: &#039;strURL = objRS(0).Value&#039;<BR><BR>try changing it to:<BR>strURL = objRS(0)<BR><BR>this is equivalent to: strURL = objRS.fields.item(0)<BR><BR>Value is the default property of the field object. And the fields collection is the default member of the Recordset object. So i think by trying to reference objRS(0).value, that code is too redundant, as objRS(0) by default contains the value, so trying to reference the value of the value generates an error? Well, I could be completely wrong too :) Hope this helps!!

Posting Permissions

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