Please Help Out .. Db Problim

Discussion in 'ASP General' started by Stefan Vorster, Dec 3, 2003.

  1. Ok i have a table in a database that looks like this

    Id , user , Time
    1 test 200312341
    2 test 324234234
    3 userna 232837872

    But i just wanne show on the page

    test
    userna

    How can i do that
    Stefan Vorster, Dec 3, 2003
    #1
    1. Advertising

  2. Stefan Vorster

    Ray at Guest

    select distinct [user] from theTable

    Ray at home

    "Stefan Vorster" <> wrote in message
    news:01a401c3b96c$bcaa26a0$...
    > Ok i have a table in a database that looks like this
    >
    > Id , user , Time
    > 1 test 200312341
    > 2 test 324234234
    > 3 userna 232837872
    >
    > But i just wanne show on the page
    >
    > test
    > userna
    >
    > How can i do that
    Ray at, Dec 3, 2003
    #2
    1. Advertising

  3. Hi,

    Paste this code into a new asp file. Set you Database Connection(objConn) and put your table names.

    <html>
    <head><title></title></head>
    <body>
    <table width="80%" align="center">
    <%
    Dim id, objRs
    id = Trim(Request.Form("id"))
    sql = "select * from table_name "
    Set objRs = Server.CreateObject("ADODB.Recordset")
    objRs.Open sql, objConn
    while not objrs.EOF
    %>
    <tr>
    <td><%=objRs("id")%></td>
    <td><%=objRs("user")%></td>
    <td><%=objRs("time")%></td>
    </tr>
    <%objrs.MoveNext
    Wend
    %>
    </table>
    </body>
    </html>
    <%Set objRs = Nothing %>
    Bhaskardeep Khaund, Dec 3, 2003
    #3
  4. Stefan Vorster

    Jeff Cochran Guest

    On Tue, 2 Dec 2003 23:11:56 -0800, "Stefan Vorster"
    <> wrote:

    >Ok i have a table in a database that looks like this
    >
    >Id , user , Time
    >1 test 200312341
    >2 test 324234234
    >3 userna 232837872
    >
    >But i just wanne show on the page
    >
    >test
    >userna
    >
    >How can i do that


    How are you currently showing everything? Either just select the User
    column in your SQL query, or when your query returns everything, just
    display the user column.

    SELECT user FROM table
    {Display the whole record set using GetString()}

    - or -

    SELECT * FROM table
    {Display only the User field in a loop}

    I prefer the former, you might look at:

    http://www.aspfaq.com/show.asp?id=2467

    Jeff
    Jeff Cochran, Dec 3, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Replies:
    4
    Views:
    506
    Chris Uppal
    May 5, 2005
  2. KK
    Replies:
    2
    Views:
    550
    Big Brian
    Oct 14, 2003
  3. MuZZy
    Replies:
    7
    Views:
    1,746
    Mike Hewson
    Jan 7, 2005
  4. shapper
    Replies:
    0
    Views:
    340
    shapper
    Dec 18, 2007
  5. mera
    Replies:
    7
    Views:
    1,100
Loading...

Share This Page