Hello Everyone,
How do I get the ADOX.Catalog object to list the columns in a table based up how they are layed out in the db? Right now, it sorts them by name.
Here is what I am doing right now:
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C:\thomas\thomas.mdb"
Set objRS = Server.CreateObject("ADODB.Recordset"
objRS.ActiveConnection = objConn
objRS.CursorType = adOpenForwardOnly
objRS.CursorLocation = adUseServer
objRS.LockType = adLockReadOnly
Set objCatalog = Server.CreateObject("ADOX.Catalog"
objCatalog.ActiveConnection = objConn
Set objTable = objCatalog.Tables("addr"
For Each strColumn In objTable.Columns
objRS.Source = "SELECT "& strColumn.Name &" FROM addr;"
objRS.Open
Response.Write strColumn.Name & VBCrLF
objRS.Close
Next
Set objTable = Nothing
Set objRS = Nothing
Set objCatalog = Nothing
objConn.Close
Set objConn = Nothing
How do I get the ADOX.Catalog object to list the columns in a table based up how they are layed out in the db? Right now, it sorts them by name.
Here is what I am doing right now:
Set objConn = Server.CreateObject("ADODB.Connection"
objConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=C:\thomas\thomas.mdb"
Set objRS = Server.CreateObject("ADODB.Recordset"
objRS.ActiveConnection = objConn
objRS.CursorType = adOpenForwardOnly
objRS.CursorLocation = adUseServer
objRS.LockType = adLockReadOnly
Set objCatalog = Server.CreateObject("ADOX.Catalog"
objCatalog.ActiveConnection = objConn
Set objTable = objCatalog.Tables("addr"
For Each strColumn In objTable.Columns
objRS.Source = "SELECT "& strColumn.Name &" FROM addr;"
objRS.Open
Response.Write strColumn.Name & VBCrLF
objRS.Close
Next
Set objTable = Nothing
Set objRS = Nothing
Set objCatalog = Nothing
objConn.Close
Set objConn = Nothing