ASP display * from table
I am kind of new to asp, but experienced with PHP and .net .
I am doing some reverse engineering of a site, I have the server connection info, and think that I have a table that I am interested in.
I could create a recordset connected to the sql ("select * from thisTable") but I don't know the corresponding field names (that is what I want to know).
Anyone able to tell me where to go on this? probably pretty easy...
Thanks very much,
If I'm correct you only want to know the column names in a table?
dim aMyRecordSet, boolSuccess
aMyRecordSet = aGetRecords ("SELECT * from TABLE;")
boolSuccess = Dump2dArray(aMyRecordSet)
dim intTotalRowCount, intTotalColCount, intColCounter, intRowcounter
intTotalRowCount = ubound(aMyRecordSet,2)
intTotalColCount = ubound(aMyRecordSet,1)
FOR intRowcounter = 0 TO intTotalRowCount
FOR intColCounter = 0 TO intTotalColCount
response.write "<li>"&aMyRecordSet(intColCounter, intRowcounter)&"</li>"
function aGetRecords (strSQL)
dim conn, rs
Set conn = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
rs.open strSQL, conn
if not rs.BOF and not rs.EOF then
aGetRecords = rs.GetRows
Set rs = Nothing
Set conn = Nothing
there is a fields collection on the recordset object you can use to get the names.
so you can use
for i = 0 to rs.fields.length - 1
response.write "<br>" & rs.fields(i).name
i think. (might not be perfect, i just wrote it from memory).
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)