Results 1 to 2 of 2

Thread: TableDefs in ASP?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    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

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    ma,usa
    Posts
    485
    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>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width