Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 9 of 9
  1. #1
    Senior Member Maverick's Avatar
    Join Date
    Sep 2003
    Location
    Hoboken, NJ
    Posts
    351
    Member #
    3253
    Hello,

    Here's what I want to to:
    Create a SQL db for the Link Directory section of my site (http://www.poker-resource.com/) with fields for site name, url, category 1, category 2, rank, and description. Using ASP, I want to users to browse the database either by clicking the category link, which displays all links in that category in seperate table rows and fields seperated by columns of the table, or by searching via search form.

    Being that I only have basic knowledge of SQL and ASP please make detailed replies if possible.

    Thanks!
    www.stevenspoker.com
    "You can't lose what you don't put in the middle, ... but you can't win much either." -Mike McDermott (Rounders)

  2.  

  3. #2
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Here's your database (run the script in query analyzer to create the database):
    Code:
    CREATE DATABASE db_links;
    GO
    USE db_links;
    GO
    CREATE TABLE categories (
        id int NOT NULL,
        name varchar(255) NOT NULL,
        PRIMARY KEY (id)
    );
    CREATE TABLE links (
        id int NOT NULL IDENTITY(1, 1),
        category1 int NULL REFERENCES categories(id),
        category2 int NULL REFERENCES categories(id),
        rank int NULL,
        name varchar(255) NOT NULL,
        url varchar(255) NOT NULL,
        description text NULL,
        PRIMARY KEY (id)
    );
    GO
    INSERT INTO categories (id, name) VALUES (1, 'e-Stores');
    INSERT INTO categories (id, name) VALUES (2, 'News Sites');
    INSERT INTO categories (id, name) VALUES (3, 'Portals');
    
    INSERT INTO links (category1, category2, rank, name, url, description)
    VALUES (1, 2, 1, 'CNN Shop', 'http://www.cnnshop.com', 'News and stuff');
    
    INSERT INTO links (category1, category2, rank, name, url, description)
    VALUES (2, 3, 1, 'Amazon', 'http://www.amazon.com', 'Books, etc.');
    Ok, so here's how you'd access it through ASP:
    Code:
    <%@Language=VBScript%>
    <html>
    <body bgcolor="FFFFFF">
    <%
    Set oConn = Server.CreateObject("ADODB.Connection")
    oConn.Open "db_links", "username", "password"
    
    If Len(Request("categories")) > 0 Then
    %>
    <h2><%=Request("name")%></h2>
    <%
         sql = "SELECT * FROM links "_
            & " WHERE category1 = " & Request("category") _
            & " OR category2 = " & Request("category")
         Set oRs = oConn.Execute(sql)
         Do While Not oRs.EOF
    %>
         <a href="<%=oRs("url")%>">
              <%=oRs("name")%>
         </a><br>
    <%
              oRs.MoveNext
         Loop
    %>
        &mbsp;<br>
        <a href="<%=Request.ServerVariables("SCRIPT_NAME")%>">Back</a><br>
    <%
    Else
    %>
    <h2>Categories</h2>
    <%
         sql = "SELECT * FROM categories"
         Set oRs = oConn.Execute(sql)
         Do While Not oRs.EOF
    %>
         <a href="<%=Request.ServerVariables("SCRIPT_NAME")%>?category=<%=oRs("id")%>&name=<%=oRs("name")%>">
              <%=oRs("name")%>
         </a><br>
    <%
              oRs.MoveNext
         Loop
    End If
    
    oRs.Close
    Set oRs= Nothing
    
    oConn.Close
    Set oConn = Nothing
    %>
    </body>
    </html>
    The only thing you might have to play around with is the oConn settings.

    That should do it for ya !!!

  4. #3
    Senior Member Maverick's Avatar
    Join Date
    Sep 2003
    Location
    Hoboken, NJ
    Posts
    351
    Member #
    3253
    wow, thanks A LOT transio! That should help me out quite a bit

    I'll let u know how it works out.

    Thanks again!

    P.S. where could I get a free query analyzer from?
    www.stevenspoker.com
    "You can't lose what you don't put in the middle, ... but you can't win much either." -Mike McDermott (Rounders)

  5. #4
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    Query Analyzer comes with SQL Server.

    If you're using someone else's SQL Server, ask them if they have a web-based db admin tool.

  6. #5
    Senior Member Maverick's Avatar
    Join Date
    Sep 2003
    Location
    Hoboken, NJ
    Posts
    351
    Member #
    3253
    Yeah, the SQL server that has my db is actually hosted by the Internet hosting company that I work for (Name/Link Removed). So I can actually log into the server (via remote desktop ) and work on the db directly while at work, but I have no way of accessing it at home.

    P.S. If you are in need of some really solid web hosting, I would reccommend Name/Link Removed. And not just cuz I work there, we just have very fast and reliable services, with great tech support. It is actually ranked as one of the top hosting companies in the country.
    www.stevenspoker.com
    "You can't lose what you don't put in the middle, ... but you can't win much either." -Mike McDermott (Rounders)

  7. #6
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    maverick, please don't advertise here!! You oughta know by now that it's against the rules !!!!

  8. #7
    Senior Member Maverick's Avatar
    Join Date
    Sep 2003
    Location
    Hoboken, NJ
    Posts
    351
    Member #
    3253
    whoops, sorry. I wasnt trying to advertise for the companies sake, just making a suggestion based on my personal experience.
    www.stevenspoker.com
    "You can't lose what you don't put in the middle, ... but you can't win much either." -Mike McDermott (Rounders)

  9. #8
    Banned
    Join Date
    Feb 2010
    Posts
    1
    Member #
    21275
    If you're using someone else's SQL Server, ask them if they have a web-based db admin tool.
    ------------------------------
    SPAM.SPAM

  10. #9
    WDF Staff smoseley's Avatar
    Join Date
    Mar 2003
    Location
    Boston, MA
    Posts
    9,729
    Member #
    819
    Liked
    205 times
    If you're looking to spam a forum, try a different one. :-D


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 03:24 AM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com