Results 1 to 4 of 4

Thread: Asp and an Access Database

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Location
    UK
    Posts
    204

    Question Asp and an Access Database

    Hi,

    Ive attached a database called kbdb.mdb

    If my asp page is given the 'ArticleId' how can I list all the other information in that row?

    Like this:

    Input:
    ArticleId

    ->

    Output:
    Product
    Keywords
    Date
    Time
    ShortDescription
    Longdescription

    Many thanks

    Hope this is clear to you.

    Neil
    Attached Files Attached Files

  2. #2
    Frenzied Member Memnoch1207's Avatar
    Join Date
    Feb 2002
    Location
    DUH, Guess...Hint: It's really hot!
    Posts
    1,861
    "SELECT * FROM tableName WHERE articleId = " & request("articleId")
    Being educated does not make you intelligent.

    Need a weekend getaway??? Come Visit

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Aug 2001
    Location
    UK
    Posts
    204

    ...

    Can anyone include the rest of the code?

    Im still fairly new to asp and dont really know what to do with that piece code?

    Thank you

  4. #4
    Frenzied Member andreys's Avatar
    Join Date
    Sep 2002
    Location
    Los Angeles
    Posts
    1,615
    Code:
    Dim rs, strSQL, conn
    
    conn="Driver={Microsoft Access Driver (*.mdb)};DBQ=" & server.mapath("\db\yourdb.mdb")
    strSQL="SELECT * FROM tableName WHERE articleId = " & request("articleId")
    
    set rs=server.createobject("ADODB.Recordset")
    rs.open strSQL, conn
    
    if not rs.eof then
    
        response.write "<table border='1'>"
        response.write "<tr>"
    
        for i=0 to rs.fields.count-1
            response.write "<th bgcolor='silver'>" & rs(i).name & "</th>"
        next
    
        response.write "</tr>"
        
        do until rs.eof
            response.write "<tr>"
            for i=0 to rs.fields.count -1
                response.write "<td>&nbsp;" & rs(i).value & "</td>"
            next
            response.write "</tr>"
            rs.movenext
        loop
    
        response.write "</table>"
    else
        response.write "No data found!"
    end if
    
    rs.close
    set rs=nothing

Posting Permissions

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



Click Here to Expand Forum to Full Width