Please Help Out .. Db Problim

S

Stefan Vorster

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
 
B

Bhaskardeep Khaund

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 %>
 
J

Jeff Cochran

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,432
Messages
2,571,680
Members
48,796
Latest member
Greg L.

Latest Threads

Top