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.

How to get ContentID Item to display in page????

Discussion in 'C#' started by danjapro, Jul 24, 2009.

  1. #1
    I cannot get my code to call the ContentID of the Item alon to display. It calls the latest on.
    How can I fix me Select Statement to call only the ContentID that matches the Request.QueryString ContentID. PLEASE HELP!!!!!!!

    Simple I need to display the RelatedURL of the item being viewed on the page.
    SEMrush
    <%
    DIM objRS, RelatedURL
    ContentID = Request.QueryString("ContentID")
    'mySQL = "SELECT * FROM Content ORDER BY DateAdded DESC" 
    mySQL1 = "SELECT ContentID, ContentType, RelatedURL, DownloadURL, Thumbnail, FeaturedLabel, ShortDesc, LongDesc, Title AS Title " & _ 
    	"FROM (Content LEFT JOIN ContentTypes ON Content.ContentTypeId = ContentTypes.ContentTypeId) " & _ 
    	"WHERE ContentTypes.ContentTypeId = 7 AND Display=1 AND '" & strContentID &"' ORDER BY Priority, DateAdded DESC"
    
    
    
    Set objRS = Server.CreateObject("ADODB.Recordset")
    objRS.Open mySQL1, objConn
    %>
    
    
    
    
    
    <embed src='<% =objRS("RelatedURL") %>&hl=en&fs=1&' width='340' height='260' type='application/x-shockwave-flash' wmode='transparent' allowscriptaccess="always" allowfullscreen="false"/></embed>
    
    
    
     <%
    
    objRS.Close
    Set objRS = Nothing
    objConn.Close
    Set objConn = Nothing
    %>
    Code (markup):
     
    danjapro, Jul 24, 2009 IP
    SEMrush
  2. mbm2000

    mbm2000 Peon

    Messages:
    12
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Hello
    I Editted Your code but I don't know what's " & strContentID &"
    Here is your code

    
    <%
    Set objConn = Server.CreateObject("ADODB.Connection")
    objConn.CursorLocation = 3
    objConn.open strConn
    
    DIM objRS, RelatedURL
    ContentID = Request.QueryString("ContentID")
    'mySQL = "SELECT * FROM Content ORDER BY DateAdded DESC" 
    mySQL1 = "SELECT ContentID, ContentType, RelatedURL, DownloadURL, Thumbnail, FeaturedLabel, ShortDesc, LongDesc, Title " 
    mySQL1 = mySQL1 & "FROM (Content LEFT JOIN ContentTypes ON Content.ContentTypeId = ContentTypes.ContentTypeId) " 
    mySQL1 = mySQL1 & "WHERE ContentTypes.ContentTypeId = 7 AND Display=1 AND '" & strContentID &"' ORDER BY Priority, DateAdded DESC;"
    
    
    
    Set objRS = ObjConn.Execute(mySQL1)
    objRS.Open mySQL1, objConn
    %>
    
    
    
    
    
    <embed src='<% =objRS("RelatedURL") %>&hl=en&fs=1&' width='340' height='260' type='application/x-shockwave-flash' wmode='transparent' allowscriptaccess="always" allowfullscreen="false"/></embed>
    
    
    
     <%
    
    objRS.Close
    Set objRS = Nothing
    Set objConn = Nothing
    %>
    
    Code (markup):
     
    mbm2000, Jul 24, 2009 IP
  3. EmeraldOne

    EmeraldOne Peon

    Messages:
    35
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I think that you are missing something..
    In one hand you are taking the queryString on this line:
    ContentID = Request.QueryString("ContentID")

    Then in the query you are concatinating as follows:
    "WHERE ContentTypes.ContentTypeId = 7 AND Display=1 AND '" & strContentID &"' ORDER BY Priority, DateAdded DESC"

    Well, where from you are getting data into strContentID????
    You have to use Just ContentId like in the first line...


    Isaac,
    http://www.7Live7.com
     
    EmeraldOne, Jul 25, 2009 IP