Monday, February 20, 2012

List all SQL/VS.NET objects on an aspx page?

Hi guys,

Being new to ASP.NET, I may be asking something that is dead simple, but please bear with me!

How would I go about listing all the tables, stored procedures and views from a SQL database within an aspx page? I understand how to connect and return a dataset etc, but that's about as far as I can get. I want to be able to list all of these objects from a given db - any ideas?

Additionally (this may not be possible) - is there a way I can list all of the objects within a visual studio.net solution, again within an aspx page?

Thanks for any help,

JonSQL has a number of procs and views that allow you to get at the meta data of its database. It's also got some weird foreach functions that help too.

select * from sysobjects
is one place to start, but there are nicer views.

As for .net you can use reflection and work your way around that.

System.Reflection.Assembly.GetExecutingAssembly();
is another good starting place.|||Thanks alot - that gives me some useful pointers.
I shall have a go and post results (if anyone else is interested in how it's done).

No comments:

Post a Comment