interrogating database for field names/datatypes?

G

Guest

I'm working primarily in ASP and transitioning to
ASP.NET. This is probably entered to the wrong group but
I'm not sure of what precise database technology I'm
referencing.

I have written a decent little "codewriter" utility that
writes web admin forms, stored procedure code, and the
functions (in ASP) that calls the sprocs that interface
with the database.

The widget works by simple lookups of information that
I've entered to a database table - a very lame approach.
Much better would be to interrogate the live database
directly so as to return a recordset of field names and
datatypes for a given table.

Can someone advise me of the best/easiest way to make
this happen?
 
S

Steve C. Orr, MCSD

You could query SQL Server's system tables, but they aren't guaranteed to
stay the same between versions.

You could use ADOX, even though it's COM based. It supports multiple
databases too, so that might be a plus depending on your requirements.
Here's more info on ADOX:
http://www.able-consulting.com/ADOX_Faq.htm#Q4
http://www.4guysfromrolla.com/webtech/013101-1.shtml
Microsoft is working on new technologies that aren't COM based but they
won't be released until the next major version of .NET.
 
Y

Yan-Hong Huang[MSFT]

Hello,

Please refer to the following articles:

"HOW TO: Retrieve Schema Information by Using GetOleDbSchemaTable and Visual C# .NET"
http://support.microsoft.com/?id=309681

"HOW TO: Retrieve Column Schema by Using the DataReader GetSchemaTable Method and Visual C# .NET"
http://support.microsoft.com/?id=310107

HTH.

Best regards,
Yanhong Huang
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.

--------------------
!Content-Class: urn:content-classes:message
!From: <[email protected]>
!Sender: <[email protected]>
!Subject: interrogating database for field names/datatypes?
!Date: Thu, 24 Jul 2003 17:58:55 -0700
!Lines: 19
!Message-ID: <[email protected]>
!MIME-Version: 1.0
!Content-Type: text/plain;
! charset="iso-8859-1"
!Content-Transfer-Encoding: 7bit
!X-Newsreader: Microsoft CDO for Windows 2000
!X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4910.0300
!Thread-Index: AcNSR+xVwyAzfYW9QSKsw1k9r1FeQQ==
!Newsgroups: microsoft.public.dotnet.framework.aspnet
!Path: cpmsftngxa06.phx.gbl
!Xref: cpmsftngxa06.phx.gbl microsoft.public.dotnet.framework.aspnet:161961
!NNTP-Posting-Host: TK2MSFTNGXA08 10.40.1.160
!X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
!
!
!I'm working primarily in ASP and transitioning to
!ASP.NET. This is probably entered to the wrong group but
!I'm not sure of what precise database technology I'm
!referencing.
!
!I have written a decent little "codewriter" utility that
!writes web admin forms, stored procedure code, and the
!functions (in ASP) that calls the sprocs that interface
!with the database.
!
!The widget works by simple lookups of information that
!I've entered to a database table - a very lame approach.
!Much better would be to interrogate the live database
!directly so as to return a recordset of field names and
!datatypes for a given table.
!
!Can someone advise me of the best/easiest way to make
!this happen?
!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top