<html>
<body>
<%
    function fselect(db,query)
	dim rs
	set con=server.createObject("adodb.connection")
	con.open db
	'con.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=c:\inetpub\wwwroot\ecommerce\product.mdb"
	'con.open "PROVIDER=MICROSOFT.JET.OLEDB.4.0;DATA SOURCE=c:\inetpub\wwwroot\ecommerce\product.mdb"
	set rs=server.createObject("adodb.recordset")
	
	rs.CursorLocation= 3 ' adUseClient
	
	rs.open query,con
	
	set fselect=rs
	
	set rs.activeconnection=nothing
	
	set fselect=rs
	con.close
	set con=nothing
	
    end function
    
    function executeUpdate(query)
	dim con
	err.clear
	on error resume next
	set con=server.createObject("adodb.connection")
	con.open Application("Product")
	
	con.execute query
	
	con.close
	set con=nothing
	response.write err.description
    end function
    
    sub viewTable(table)
	dim con,rs,fld
	set con=server.createObject("adodb.connection")
	con.open Application("Product")
	set rs=server.createObject("adodb.recordset")
	
	rs.open "select * from " & table,con
	response.write "<table align=center border=1>"
	response.write "<tr>"
	for each fld in rs.fields
	    response.write "<td>" & fld.name & "</td>"
	next
	response.write "</tr>"
	
	while not rs.eof
	    if rs.bof then break
	    response.write "<tr>"
	    for each fld in rs.fields
		response.write "<td>" & fld.value & "</td>"
	    next
	    response.write "</tr>"
	    rs.moveNext
	wend
	response.write "</table>"
	rs.close
	con.close
	set rs=nothing
	set con=nothing
    end sub
    
    
    'set rs=fselect(Application("Product"),"select * from cat")
    'set rs1=fselect(Application("Product"),"select * from desccat")
    
    'deleteFilesFromCat
    viewTable request("table")
    'response.write "id=" & Session("ids") & "<br>"
%>

</body>
</html>
