Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
OLEDB/ADO Database Table Creation ?
Message
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00559939
Message ID:
00560008
Views:
35
This message has been marked as the solution to the initial question of the thread.
>Thanks for the fast response. My code below shows what I was working from before you sent your message - they look pretty identical. I am getting an error in line 19:
>
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
>
>
>I am using VBScript (in Windows Script Host 5.6).
>
>Help?

PMFJI,

I think for this it's easier to use the connection's execute method to send regular VFP SQL commands:
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.
HTH
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform