Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Sep 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    how can i make links with data fields in db

    hello
    i am newbie not only to this forum but also to ASP
    i mean now trying to learn
    i make a database table for news with field newsid , newsheadline and newdetails now i want to put the headline scrolling as marquee on page whcih is ok and doing well the code is

    Code:
    <%
    Dim conn 
    Set conn = Server.CreateObject("ADODB.Connection")
    conn.Open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog = medicalrecords; User Id = sa; Password="
    set rs = Server.CreateObject("ADODB.recordset")
    rs.Open "SELECT newid, newsheadline FROM marqlink ", conn
    %>
    <table width="558" border="1" align="center">
      <tr><td width="548">
     <marquee onMouseOver="this.stop()" onMouseOut="this.start()">
    <% Do While Not rs.EOF
      Response.Write "<a href=""dispmdett.asp.id=" & rs(0) & """>" & rs(1) & "</a>&nbsp;&nbsp;&nbsp;"
      rs.MoveNext
    Loop %>
    '<input name="h1" type="hidden" value="<%'request.querystring("link_id")%>">
      <% rs.close 
    conn.close%>
        </marquee></td></tr></table>
    but i did not know how to make the page for news details and when ever i clik on link it take me to the specific news details
    waiting for your reply
    thanks in advace
    Last edited by minhas4all; 09-07-2005 at 09:12 AM.

  • #2
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,042
    Thanks
    0
    Thanked 250 Times in 246 Posts
    The start of querystring is ? and not .
    Code:
    Response.Write "<a href=""dispmdett.asp?id=" & ...

  • #3
    New Coder
    Join Date
    Sep 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by glenngv
    The start of querystring is ? and not .
    Code:
    Response.Write "<a href=""dispmdett.asp?id=" & ...
    its ok i can go with ?
    but my problem is how to make a page to that i can link these links

  • #4
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,042
    Thanks
    0
    Thanked 250 Times in 246 Posts
    dispmdett.asp:
    Code:
    <html>
    <head>
    <title>News</title>
    </head>
    <body>
    <%
    dim id, conn, rs
    id = Request.QueryString("id")
    'validate id
    if not isnumeric(id) then
      response.write "Invalid id."
    else
      '...open db connection
      Set conn = Server.CreateObject("ADODB.Connection")
      conn.Open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog = medicalrecords; User Id = sa; Password="
      set rs = Server.CreateObject("ADODB.recordset")
      rs.Open "SELECT newid, newsheadline, newdetails  FROM marqlink WHERE newid=" & id, conn
    
      if rs.EOF or rs.BOF then
        'news not found
        response.write "News not found."
      else
        'display news details
         response.write "<h1>" & rs("newsheadline") & "</h1><p>" & rs("newdetails") & "</p>"
      end if
    
      'kill objects
      rs.close
      set rs=nothing
      conn.close
      set conn = nothing
    end if
    %>
    </body>
    </html>

  • #5
    New Coder
    Join Date
    Sep 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by glenngv
    dispmdett.asp:
    Code:
    <html>
    <head>
    <title>News</title>
    </head>
    <body>
    <%
    dim id, conn, rs
    id = Request.QueryString("id")
    'validate id
    if not isnumeric(id) then
      response.write "Invalid id."
    else
      '...open db connection
      Set conn = Server.CreateObject("ADODB.Connection")
      conn.Open "Provider=SQLOLEDB; Data Source = (local); Initial Catalog = medicalrecords; User Id = sa; Password="
      set rs = Server.CreateObject("ADODB.recordset")
      rs.Open "SELECT newid, newsheadline, newdetails  FROM marqlink WHERE newid=" & id, conn
    
      if rs.EOF or rs.BOF then
        'news not found
        response.write "News not found."
      else
        'display news details
         response.write "<h1>" & rs("newsheadline") & "</h1><p>" & rs("newdetails") & "</p>"
      end if
    
      'kill objects
      rs.close
      set rs=nothing
      conn.close
      set conn = nothing
    end if
    %>
    </body>
    </html>
    thanks
    your code is working well
    you guys are doing well
    this is my first day and i got the solution
    thanks once again


  •  

    Posting Permissions

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