I'd like to know what column names an table has. I can see the data they contain, but not the column titles.
I can use ASP to get this information from database.
| SitePoint Sponsor |

I'd like to know what column names an table has. I can see the data they contain, but not the column titles.
I can use ASP to get this information from database.


yes you can...
try this... (just error check, I'm writing on the fly here)
Code:set rs = createobject("ADODB.recordset") rs.open "select * from mytable", conn 'create a table to output column names and values '------------------------------------------------ response.write "<TABLE><TR>" 'write column names For each thingy in rs.fields response.write "<TD>" & thingy.name & "</TD>" next response.write "</TR>" 'write contents while not rs.eof response.write "<TR>" For each thingy in rs.fields response.write "<TD>" & thingy & "</TD>" next response.write "</TR>" rs.movenext wend response.write "</TABLE>"
Spartan
---------------------
It's like our sergeant told us before one trip into the jungle. Men! Fifty of you are leaving on a mission. Twenty-five of you ain't coming back.
-Mr.Payne





What database are you using? You may be able to run a query to get the columns from a table at will.
Matt - Sybase DBA / PHP fanatic
Sybase/MySQL/Oracle | I don't like MySQL
Download Sybase | DBForums.com - for all your RDBMS talk

Thank you, I got it working
Bookmarks