Drew Wutka
DWUTKA at Marlow.com
Thu Oct 9 17:15:32 CDT 2008
Ok, here is a page that will do what you want: Though you will need to modify it a bit. The 'cnn.ConnectionString' line will need to connect to your database. And this page is designed to allow you to put in any SQL you want. To fix it to a specific SQL statement, just remove the form from it, and feed the SQL string to it...(or hard code the SQL string. <html> <head> <title>SQL Statement Processing</title> </head> <body> <form name="SQLProcessing" method=post action="" ID=Form1> <textarea name="SQL" cols=160 rows=20 ID=Textarea1><%=request.Form("SQL")%></textarea> <br> <input type=submit name="Submit" value="Run SQL Statement" ID=Submit1> </form> <br><br> <% dim cnn dim rs dim i dim strResp set cnn=server.createobject("ADODB.Connection") set rs=server.createobject("ADODB.recordset") cnn.ConnectionString="Somestring" cnn.Open if request.Form("SQL")<>"" then set rs.open strSQL,cnn,1,1%> <table width="100%" border=1> <tr> <%for i=1 to rs.fields.count%> <td width="<%=(100/rs.fields.count)%>%"><%=rs.fields(i-1).Name%></td> <%next%> </tr> <%if rs.eof=false then rs.movefirst do until rs.eof=true%> <tr> <%for i=1 to rs.fields.count%> <td width="<%=(100/rs.fields.count)%>%"><%=rs.fields(i-1).value%></td> <%next%> </tr> <%rs.movenext loop%> <%end if%> </table> <%rs.close set rs=nothing end if set cnn=nothing %> </body> </html> -----Original Message----- From: accessd-bounces at databaseadvisors.com [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Reuben Cummings Sent: Thursday, October 09, 2008 12:50 PM To: AccessD Subject: [AccessD] OT - ASP, Build a web table on the fly Anyone have some code for building a table on a web page on the fly? I am pulling a set of data that consists of whatever records occur in a two week period. Therefore, I do not know how many rows there will be. I do know there will always be 4 columns. Therefore, I need some help creating 4 rows, or 40 rows, depending on the data. Thanks. Reuben Cummings GFC, LLC 812.523.1017 -- AccessD mailing list AccessD at databaseadvisors.com http://databaseadvisors.com/mailman/listinfo/accessd Website: http://www.databaseadvisors.com The information contained in this transmission is intended only for the person or entity to which it is addressed and may contain II-VI Proprietary and/or II-VI Business Sensitive material. If you are not the intended recipient, please contact the sender immediately and destroy the material in its entirety, whether electronic or hard copy. You are notified that any review, retransmission, copying, disclosure, dissemination, or other use of, or taking of any action in reliance upon this information by persons or entities other than the intended recipient is prohibited.