C:\wintemp\maketable.vbs(12,1) ADOX.Tables: Object is no longer valid.>
>Set oTable = WScript.CreateObject("ADOX.Table.2.6") >Set oConn = WScript.CreateObject("ADODB.Connection") >Set oCat = WScript.CreateObject("ADOX.Catalog.2.6") >Set oKey = WScript.CreateObject("ADOX.Key.2.6") >oConn.Open "Provider=VFPOLEDB.1;Data Source=e:\src\projects\lookupcache.dbc" >oConn.CursorLocation = 2 ' adUseServer >oTable.Name = "Test01" >oTable.Columns.Append "iID" , 3 ' Integer >oKey.Name = "MyPK" >oKey.Type = 1 ' Primary Key >oKey.Columns.Append "iID" >oCat.Tables.Append oTable <-- Error! >oTable.Keys.Append oKey >>
oConn.Execute "CREATE TABLE myTable (iID i PRIMARY KEY, desc c(30))"
This creates the table with a couple of fields with iID being the primary key.