WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

ADO DAO
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

ADOX Append Table Columns

 Keywords:  ADOX Append Table Columns

Sample code:

adVarWChar = 202
adInteger  = 3
file = "C:\TEMP\NEW.MDB" ; change to suit your situation
Conn="Provider=MicroSoft.Jet.OLEDB.4.0; Data Source=%file%;Jet OLEDB:Engine Type=4"
IF FileExist(file) == @TRUE
  FileDelete(file)
Endif

cat = ObjectOpen("ADOX.Catalog")
tbl = ObjectOpen("ADOX.Table")

cat.Create(Conn)

tbl.name = "Test" ; IMPORTANT: Name the table before attempting to append.
tbls = cat.Tables ; collection of tables
tbls.Append(tbl) ; Append table to tables collection

props = tbl.Properties; collection of properties
cols = tbl.Columns ; collection of columns

nCnt  = props.Count()

message("Number of Table Properties",nCnt) ;
message("Number of Column Properties",cols.Count) 


cols.append("ID",adInteger) ; Append column to columns collection
cols.append("ID2",adInteger) ; Append column to columns collection
cols.append("Name",adVarWChar) ; Append column to columns collection

message("NEW Number of Table Properties",props.Count)
message("NEW Number of Column Properties",cols.Count)


ObjectClose(tbl)
ObjectClose(tbls)
ObjectClose(cat)
BoxShut()

exit

Article ID:   W15238
File Created: 2002:09:05:13:50:46
Last Updated: 2002:09:05:13:50:46