Dan,
Thanks for the input. I have the means to create my dynamic table already, it is getting the sql results into it that I am struggling with. Here is the simplified code I have so far.
The dynamic table works ok in it's own right, and the results come from the database ok. It is merging the two so the results are dynamic depending upon my field list.
Hopefully you can see my dillema.
<%@LANGUAGE="JAVASCRIPT"%>
<!--#include file="Connections/Assessment.asp" -->
<%
var Assessment = Server.CreateObject("ADODB.Recordset");
Assessment.ActiveConnection = MM_Assessment_STRING;
Assessment.Source = "SELECT * FROM assdata.txt";
Assessment.CursorType = 0;
Assessment.CursorLocation = 2;
Assessment.LockType = 1;
Assessment.Open();
var Assessment_numRows = 0;
%>
<%
var Repeat1__numRows = -1;
var Repeat1__index = 0;
Assessment_numRows += Repeat1__numRows;
%>
<html>
<head>
<title></title>
<script>
function start() {
// get the reference for the body
// split the column names
var collist="ab,cd,ef,4,5,6,7";
var colname=collist.split(",");
// This is the list of field names that are recovered from the database
var fieldlist="studname,yg,fg,4,5,6,7";
var fieldname=fieldlist.split(",");
var body = document.getElementsByTagName("body")[0];
// creates a <table> element and a <tbody> element
var tbl = document.createElement("table");
var tblBody = document.createElement("tbody");
alert(colname.length);
// headers
var row = document.createElement("tr");
for (var i = 0; i < colname.length; i++) {
// Create a <td> element and a text node, make the text
// node the contents of the <td>, and put the <td> at
// the end of the table row
var cell = document.createElement("td");
var cellText = document.createTextNode(colname);
cell.appendChild(cellText);
row.appendChild(cell);
}
tblBody.appendChild(row);
// end headers
// This section takes the array fieldlist and adds the column information depending upon this list and results
// from the database
// creating all cells
// While not end of file - put the test for eof here
for (var j = 1; j < 2; j++) {
// creates a table row
var row = document.createElement("tr");
// each cell within a row
for (var i = 0; i < fieldname.length; i++) {
// Create a <td> element and a text node, make the text
// node the contents of the <td>, and put the <td> at
// the end of the table row
var cell = document.createElement("td");
var cellText = document.createTextNode("column name goes here");
cell.appendChild(cellText);
row.appendChild(cell);
}
// add the row to the end of the table body
tblBody.appendChild(row);
}
// put the <tbody> in the <table>
tbl.appendChild(tblBody);
// appends <table> into <body>
body.appendChild(tbl);
// sets the border attribute of tbl to 2;
tbl.setAttribute("border", "2");
}
</script>
</head>
<body onLoad="start()">
</body>
</html>
<%
Assessment.Close();
%>