PDA

Click to See Complete Forum and Search --> : TableDefs in ASP?


joey o.
Oct 21st, 2000, 08:40 AM
HI,
I'm basing this on what I'd do using VB. How do I get a list of fields in a table in the database using vbscript in ASP?

Code that doesn't work:
<%
Dim Connect, Query, tmst, SQLstr, varName
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "NewSite"
SQLstr = "Select * from Tracking"
Set Query = Connect.Execute (SQLstr)
%>
<Table>
<tr>
<td> <%=Query.TableDefs.Count - 1%>
</table>

Thanks

joey o.
Oct 21st, 2000, 08:56 AM
OOPS!
I guess I didn't think enough before asking that one, sorry.
I figured it out. This code works:

<%
Dim Connect, Query, tmst, SQLstr, varName
Set Connect = Server.CreateObject("ADODB.Connection")
Connect.Open "NewSite"
SQLstr = "Select * from Tracking"
Set Query = Connect.Execute (SQLstr)
%>
<Table>
<BR><%For tableCount = 0 to Query.Fields.Count - 1%>
<BR> <%= Query.Fields(tableCount).name%>
<BR><%Next%>
<BR>
<BR>
</table>