Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: ADO Constant - Primary Key


Message #1 by PenPrints <info@p...> on Sun, 28 Jan 2001 12:01:14 -0500
What is the proper ADO constant to use in determining whether or not a 

field is an Autonumber field in Access 2000?

....and how is it applied?



something like :



If field.attributes = constant then execute code

_______________________________________________

PenPrints - Clamshell Boxes, Hand Bound Books,

and Fine Art



http://www.penprints.com



Message #2 by Imar Spaanjaars <Imar@S...> on Mon, 29 Jan 2001 07:50:08 +0100
You'll need ADOX to do that. A column has a Properties property. One of the 

items in this collection is "Autoincrement".

Here is a short example on how to retrieve this information.





strDBPath = "C:\testDatabase.mdb"

Dim catDB  ' As ADOX.Catalog

Dim tblMyTable  ' As ADOX.Table

Set catDB = Server.CreateObject("ADOX.Catalog")

    ' Open the catalog.

catDB.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _

       "Data Source=" & strDBPath

Set tblMyTable = catDB.Tables("Contacts")

Dim aColumn ' As ADOX.Column

Set aColumn = tblMyTable.Columns("ID")



Response.Write(aColumn.Properties("Description")) ' This will write out the 

description of the column

Response.Write(aColumn.Properties("Autoincrement")) ' This will write out 

either true or false.





HtH



Imar





At 03:54 AM 1/29/2001 -0800, you wrote:

>What is the proper ADO constant to use in determining whether or not a

>field is an Autonumber field in Access 2000?

>....and how is it applied?

>

>something like :

>

>If field.attributes = constant then execute code

>_______________________________________________

>PenPrints - Clamshell Boxes, Hand Bound Books,

>and Fine Art

>

>http://www.penprints.com




  Return to Index