Extra column is getting built

J

Jack

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>
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top