Click to See Complete Forum and Search --> : how to display metadata using asp
method
03-03-2005, 12:49 PM
hi guyes i have a database in sql server 2000 and i want to write an asp script that using ado connection to that database and uses the metadata to display all the colums of a perticuler table.(no information about tables ,colums,datatypes, primary keys and foreign keys should be hardcoded). Could any one help me how i do this. Thanks
equvilent to this one :
select * from players
<table width="200" border="1">
<tr>
<td>Player ID</td>
<td>Name</td>
<td>Intials</td>
</tr>
<% while not rs.eof %>
<tr>
<td><a href = "playerprofile.asp?person_id=<%=rs("playerno")%>"><%=rs("playerno")%></a></td>
<td><%=rs("name")%></td>
<td><%=rs("initials")%></td>
</tr>
<% rs.movenext
wend
%>
</table>
phpnovice
03-03-2005, 12:53 PM
You would use ADOX to get to the meta data.
http://msdn.microsoft.com/library/en-us/ado270/htm/dasdkadooverview.asp
method
03-03-2005, 01:08 PM
Originally posted by phpnovice
You would use ADOX to get to the meta data.
http://msdn.microsoft.com/library/en-us/ado270/htm/dasdkadooverview.asp
man thas is a long technical stuff!! lol. i am looking for something simple!!
phpnovice
03-03-2005, 01:11 PM
Well, once you know it, it *is* pretty simple. :D
Concentrate first on the ADOX.Catalog object.
phpnovice
12-11-2005, 02:33 PM
By the way... I have since found that you don't need to use ADOX (http://msdn.microsoft.com/library/en-us/ado270/htm/admscadoapireference.asp) just to display the structure (the schema) of your database. ADOX can do it, but it is not required. Standard ADO (http://msdn.microsoft.com/library/en-us/ado270/htm/mdmscadoapireference.asp) can display the schema of your database -- but I've written both and I actually think that using ADOX is easier, in some ways, than the requirements of the ADO OpenSchema (http://msdn.microsoft.com/library/en-us/ado270/htm/mdmthopenschema.asp) method.
Cheers.
russell_g_1
12-12-2005, 05:53 AM
you could also try a query like this one
select t.name,c.*
from sysobjects o
join syscolumns c on (c.id = o.id)
join systypes t on (t.xtype = c.xtype)
where o.type = 'u' and o.name = 'person'
it gets all the column info for a table called person