<% y = request.form("Action") %> <% ' THIS IS ASP CODE FOR A DSN-LESS CONNECTION (DSN = data source name) dim conntemp, rstemp 'Declare all variables accessdb="fgp1.mdb" 'Specify Database, Driver, path... myDSN="DRIVER={Microsoft Access Driver (*.mdb)};" ' MS Access driver myDSN=myDSN & "DBQ=" & server.mappath(accessdb) ' Map path to DB mySQL="SELECT * FROM Test1" set conntemp=server.createobject("adodb.connection") 'Set a temporary connection (conntemp) conntemp.open myDSN 'Open the connection set rstemp=conntemp.execute(mySQL) 'Exec SQL and count fields - build a temporary recordset (rstemp) howmanyfields=rstemp.fields.count -1 'Stop and Count fields in Recordset %>
<% for i=0 to howmanyfields%> <% next %> <% ' Get all the records - new row do while not rstemp.eof ' x=x+1 %> <% for i = 0 to howmanyfields %> <% next %> <%rstemp.movenext ' move to next record - 1 row here for each row brought back in SQL query loop%>
Result of Show All Product in Database
View All Tables <%=rstemp(i).name%>
<%=x%> <%=rstemp(i)%>
<% rstemp.close ' Close file and recordset set rstemp=nothing conntemp.close set conntemp=nothing %>