1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Writing ASP Strings to SQL Server

Discussion in 'C#' started by mrbrantley, Jul 29, 2009.

  1. #1
    I am creating some description blurbs where I want to include certain variables inside of the description. When I create the blurb, I set the variables where I want them.

    example.... Find the best <%=Color%> Widgets in Town. We carry tons of <%=CategoryName%> Widgets for your <%=Color%> Widgitizer.

    As it is written to the db, the dynamic chars are escaped. When the db writes to the page, it displays the tag on the screen instead of executing it. When I put the string ( <%=Color%> ) directly into SQL server, it does not output anything. The page still works, but the spot where I called that instance is blank.

    I have assigned and tested all variabled when not written from the DB and they all work fine.

    Any ideas on this one? Im stumped.
     
    mrbrantley, Jul 29, 2009 IP
  2. mrbrantley

    mrbrantley Member

    Messages:
    87
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    43
    #2
    Nevermind, I got it.

    Maybe this will help someone in the future.

    Using JScipt / ASP, I used the variable name instad of an ASP variable.

    so

    response.write(string.replace("--Color--","Color"))

    worked great where

    response.write(string.replace("<%=Color%>","Color"))

    did not.

    Cant beleive I even tried that.... poor judgement.
     
    mrbrantley, Jul 29, 2009 IP