Ask Experts Questions for FREE Help !
Ask
    sssaudddahmed's Avatar
    sssaudddahmed Posts: 4, Reputation: 1
    New Member
     
    #1

    Mar 31, 2005, 12:51 AM
    Dreamweaver MX: ASP.NET creating art gallery
    I am creating a web art gallery. The problem I am having at the moment is that I want to link members on the site to their gallery page.

    I have a page with members name on them. I want to link those names to a single gallery page. Depedning on what name I pressed on, I want the gallery page to change to display that members art.

    Furthermore at the top of the page there will be another table that will display the member profile and name according to the name that was pressed.

    I am using DWMX, IIS, ASP.NET, MS Access. I have linked to the page using OLEDB and I have two datasets one for members details and the second for picture details.

    Please can someone tell me how this can be done.
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #2

    Mar 31, 2005, 02:30 AM
    Haven't touched ASP for years, so I can't be detailed but here's what you need to do.

    On the page with all the members names, you want the link to the gallery page to be something like <a href="gallery.asp?name=memberID">. To do this you'll need a loop that loops through each member's details, creating a link using their name/id/whatever you are using as a primary key on the members table.

    Then on the gallery page you will need to retrieve the value of memberID from the querystring. Can't remember the ASP syntax to do this :(

    Then use this value to peform an SQL query retrieving the data just for that member. I.e. for the table at the top with the member details - "Select * from members where memberID = '"+ memberID +"';"

    That's basically how you do it. Hopefully some of the other experts can fill in the syntax gaps. If not, I'll do it when I get home tonight (if I remember).
    sssaudddahmed's Avatar
    sssaudddahmed Posts: 4, Reputation: 1
    New Member
     
    #3

    Apr 1, 2005, 12:46 AM
    Sorry for the late peply.

    I understand what you mean by using the member number in otder to relate the member list to the galley. But since I am new to ASP.NET could be describe in details what synataxs I should use and where in the script page I should put it.

    Sorry for the inconvienence.
    LTheobald's Avatar
    LTheobald Posts: 1,051, Reputation: 127
    Ultra Member
     
    #4

    Apr 7, 2005, 04:58 AM
    Sorry it's taken me a long time to reply. OK, here's my understanding of how it would be done (remember I've not done ASP for years so it may be slightly incorrect)

    First Page - Shows member names

    Code:
    <html>
    <head>
    <title>Members</title>
    </head>
    
    <body>
    <%
    
    ' Create Connection and Recordset objects
    Set Conn = Server.CreateObject("ADODB.Connection")
    Set Rs = Server.CreateObject("ADODB.RecordSet")
    
    ' Open the connection to the ODBC source, in this case
    ' the Access database
    Conn.Open "your_ODBC_source"
    
    ' Now, create the SQL statement
    SQL = "SELECT id, name FROM tbl_member"
    
    ' Execute the SQL statement to get a recordset
    Set Rs = Conn.Execute(SQL)
    
    ' While records remain in the record set
    Do While NOT Rs.EOF
      ' Print out a link for the current member
      Response.Write("<a href=""gallery.asp?id="& Rs.Fields("id").value &""">"& Rs.Fields("id").value &"</a>")
    
      ' Move to the next record 
      Rs.MoveNext
    Loop
    
    ' Tidy Up
    Rs.Close
    Set Rs = Nothing
    Conn.Close
    Set Conn = Nothing
    
    %>
    </body>
    </html>
    Page 2 - Gallery
    Code:
    <html>
    <head>
    <title>Members</title>
    </head>
    
    <body>
    <%
    
    ' Retrieve the user's ID.  You'll want this to retrieve the users data
    userID = Request.QueryString("id")
    
    ' Create Connection and Recordset objects
    Set Conn = Server.CreateObject("ADODB.Connection")
    Set Rs = Server.CreateObject("ADODB.RecordSet")
    
    ' Open the connection to the ODBC source, in this case
    ' the Access database
    Conn.Open "your_ODBC_source"
    
    ' Now, create the SQL statement
    SQL = "SELECT * FROM tbl_gallery WHERE memberID = "& userID
    
    ' Execute the SQL statement to get a recordset
    Set Rs = Conn.Execute(SQL)
    
    ' While records remain in the record set
    Do While NOT Rs.EOF
      '  
      ' Do whatever you want with the data here!
      '
    
      ' Move to the next record 
      Rs.MoveNext
    Loop
    
    ' Tidy Up
    Rs.Close
    Set Rs = Nothing
    Conn.Close
    Set Conn = Nothing
    
    %>
    </body>
    </html>

    This was all pieced together off another website so sorry if it's inconsistent etc.
    sssaudddahmed's Avatar
    sssaudddahmed Posts: 4, Reputation: 1
    New Member
     
    #5

    Apr 16, 2005, 11:13 PM
    Thanks for the reply. I tried using your code for my website and it worked. Thanks

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

How To Add Text Background In Dreamweaver? [ 2 Answers ]

Hi, I created a website which has a very colourful background image so when I put text on it you cannot read the text properly. I used to use a program called Namo Web Builder and in this there was a function which put a background around the text you was typing. Check out...

Creating xp disc [ 3 Answers ]

I have purchased a second hand computer which has xp loaded on it but it did not come with an xp disc. I want to transfer the required files from this computer to make a bootable disc so that I can re-install if it is required later. Thanks

Dreamweaver and auto resizing [ 5 Answers ]

I am working on a website in Dreamweaver and I am running into a small problem. I am working on a large screen laptop with screen settings of 1440 x 900 pixels. Of course everything looks fine. However, when I go to a different computer with 800 x 600 settings or something different than...


View more questions Search