Creating Tables with ADOX
I am using ADOX to create tables in a database. My users are creating the
field names so I won't know what they are until I open the new table. I
am using the following code:
Dim NewTable As New Table
Dim catTable As New ADOX.Catalog
Set NewTable = New Table
catTable.ActiveConnection = "myDB.mdb"
NewTable.Name = "Customers"
NewTable.Columns.Append "FirstName", adVarWChar, 50
NewTable.Columns.Append "LastName", adVarWChar, 50
NewTable.Columns.Append "City", adVarWChar, 50
Set catTable = Nothing
Set NewTable = Nothing
I want to be able to use a bound data grid to display the recordset. The
problem I am running into is that ADO is creating the table with the fields
in alphabetical order instead of the order I pass in.
So, for instance, instead of First Name, Last Name, City, I get City, First
Name, Last Name. This is the order in which the grid shows the columns.
Definitely not what I want.
DAO set the ordinal postion of the fields as they were created. Apparently,
ADO does not do that. I am unable to find an ordinal postion property for
Any suggestions would be greatly appreciated. My only alternative is to
make an unbound data grid which is major headache.
Thanks - Lisa
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL