Here is the VB sample. I did the steps to create the database (except I
created it in Access 2000), and create a new table. I also created the
AutoNumber ID column, except I am stuck on the parts about setting parent
catalog and setting autoincrement to true. Then, I created a primary key.
So, I guess my question is: how do I translate the parent catalog thing
and the autoincrement thing into Python?
Thanks,
Theresa
Dim oCat As ADOX.Catalog
Dim oTable As ADOX.Table
Dim oColumn As ADOX.Column
Dim oKey As ADOX.Key
' Delete any previous temp file
On Error Resume Next
Kill ".\new35.mdb"
On Error GoTo 0
' Create a new database in 3.5 format (Access 97)
Set oCat = New ADOX.Catalog
oCat.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
��������������������� "Data Source=.\new35.mdb;" & _
��������������������� "Jet OLEDB:Engine Type=4;"
' Create a new Table
Set oTable = New ADOX.Table
oTable.Name = "WebSite"
oCat.Tables.Append� oTable
' Create a new AutoNumber ID Column
Set oColumn = New ADOX.Column
With oColumn
��� .Name = "WebSiteID"
��� .Type = adInteger
��� Set .ParentCatalog = oCat ' Must set before setting properties
��� .Properties("Autoincrement") = True
End With
oCat.Tables("WebSite").Columns.Append� oColumn
' Create a new Primary Key for the table
Set oKey = New ADOX.Key
With oKey
��� .Name = "PrimaryKey"
��� .Type = adKeyPrimary
��� .RelatedTable = "WebSite"
��� .Columns.Append "WebSiteID"
End With
oCat.Tables("WebSite").Keys.Append� oKey
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/activepython
- Re: VB sample for setting autoincrement property for a co... Theresa_Stadheim
