[thelist] Database Schema from ASP

Mike Stenhouse Mike.Stenhouse at spiritsoft.com
Tue Mar 4 08:07:01 CST 2003


--
[ Picked text/plain from multipart/alternative ]
Does anyone know if it's possible to get the Primary Keys Schema of a
SQL Server database with ASP?

I've used myConnection.OpenSchema(someSchema) to get table and column
schema data but neither have the PK info... I tried OpenSchema(28),
which ought to get the Primary Keys schema, and all the right fields are
there (TABLE_NAME, PK_NAME etc) but it's a recordset of 0 records. I do
definitely have my primary keys defined! Ideally I'd like to retrieve
the Foreign Key schema (27) as well but that doesn't seem to work either
despite having my relationships nicely diagrammed.

Does ADO not support these schemas and if not, is there any other way to
get them?

Here's my code:
------------------------------------------
var oConn = Server.CreateObject("ADODB.Connection");
var oTable = Server.CreateObject("ADOX.Catalog");

oConn.Open(connData);
oTable = oConn.OpenSchema(28);

var s = "";
s += oTable.RecordCount+"<br />";
var eCols = new Enumerator(oTable.Fields);
while (!eCols.atEnd()) {
    s += eCols.item().Name + "<br />";
    eCols.moveNext();
}
Response.write(s);
------------------------------------------

Help would REALLY be appreciated!!!

TIA

Mike

  _____

Mike Stenhouse
Creative Services Manager
SpiritSoft
+ 44 (0)20 7398 5931
www.spiritsoft.com



This message contains confidential information and is intended only for the named individual and may not be disseminated without prior permission.  If you are not the named addressee, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this message in error and delete this e-message from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, delayed in transmission, incomplete, or may contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this Message which arise as a result of e-mail transmission.  If verification is required please request a hard-copy version. This message is provided for informational purposes and should not be construed as a solicitation or offer to buy or sell any software or services.

________________________________________________________________________
This email has been scanned for all viruses by the MessageLabs SkyScan
service. http://www.messagelabs.com
________________________________________________________________________



More information about the thelist mailing list