Extra column is getting built

Discussion in 'ASP General' started by Jack, Sep 16, 2004.

  1. Jack

    Jack Guest

    Hi,
    I got a code that is supposed to build first column as blank and then columns
    corresponding to the query. However, the final result is coming with one
    extra column where the vendor code values goes into the extra column while
    the Vendor Code column is blank. Appreciate any help.
    Thanks


    CODE:

    %@ Language=VBScript %>
    <HTML>
    <TITLE> Table Procedure </TITLE>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
    </HEAD>
    <BODY>

    <%
    'Procedure to create a table
    Sub MakeTable(sourcein, dsnin)
    Dim oRSmt
    Set oRSmt = Server.CreateObject("ADODB.Recordset")
    oRSmt.Open sourcein, "DSN=" & dsnin

    oRSmt.MoveFirst
    Response.Write "<TABLE BORDER = 1><TR>"

    Response.Write "<TH>" & "&nbsp;</TH>"
    For Each objField in oRSmt.Fields
    Response.Write "<TH>" & objField.name & "</TH>"
    Next

    Do While Not oRSmt.EOF

    Response.Write "<TR>"
    For Each obFld in oRSmt.Fields
    Response.Write "<TD>" & "&nbsp;</TD>"
    Response.Write "<TD>" & obFld.value & "&nbsp;</TD>"


    Next
    oRSmt.MoveNext
    Response.Write "</TR>"
    Loop

    Response.Write "</TABLE>"
    oRSmt.Close
    Set oRSmt = Nothing
    End Sub
    %>

    <%call MakeTable("Select VendorName, VendorCode from Vendors
    where VendorCode = 'ph'", "Clothiers")%></P>

    </BODY>
    </HTML>
    Jack, Sep 16, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. AMD Desktop
    Replies:
    3
    Views:
    1,934
    Steve C. Orr [MVP, MCSD]
    Nov 2, 2004
  2. fitwell
    Replies:
    2
    Views:
    515
    fitwell
    Oct 20, 2003
  3. Paul J. Lucas
    Replies:
    2
    Views:
    393
    Paul J. Lucas
    Feb 18, 2007
  4. mathieu
    Replies:
    3
    Views:
    595
    Bo Persson
    Sep 4, 2009
  5. Rahul
    Replies:
    5
    Views:
    159
    J. Gleixner
    Mar 19, 2007
Loading...

Share This Page