Hi,
Please have the required ASP script below:
<%@LANGUAGE="vbscript" CODEPAGE="1252"%>
<%
Dim sql,conn,rs,intNoOFields
sql="select * from players"
set conn=Server.CreateObject("ADODB.Connection")
conn.Open("Provider=SQLOLEDB.1;User ID=sa;password=mypassword;Initial Catalog=MyDatabase;Data Source = MySQLServer;")
set rs = Server.CreateObject("ADODB.recordset")
rs.Open sql, conn
intNoOFields = rs.Fields.Count
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>Untitled Document</title>
</head>
<body>
<%If Not (rs.EOF And rs.BOF) Then%>
<table width="200" border="1">
<tr>
<% For i = 0 To intNoOFields - 1%>
<th><%=rs(i).Name%></th>
<% Next%>
</tr>
<% while not rs.eof %>
<tr>
<% For i = 0 To intNoOFields - 1%>
<td><%=rs(i).Value%> </td>
<% Next%>
</tr>
<% rs.movenext
wend
%>
</table>
<%end if%>
</body>
<%
rs.close
set rs=nothing
conn.close
set conn = nothing
%>
</html>
Cheers,
Pooja Falor
|