Home All Groups Group Topic Archive Search About

i have a question about rename table through ADOX with C++

Author
13 Mar 2006 3:37 PM
realjacky
i have find some code on web :
Dim cn As ADODB.Connection
Dim t As Table

Set cn = New ADODB.Connection
cn.Open "Provider=Microsoft.Jet.OLEDB.4.0;data Source=C:\biblio.mdb"
Dim cat As ADOX.Catalog
Set cat = New ADOX.Catalog
Set cat.ActiveConnection = cn
cat.Tables("Authors").Name = "Authors2"


'Iterate through the tables collection
For Each t In cat.Tables
  If t.Name = "Authors2" Then
    Debug.Print t.DateModified
  End If
Next


cn.Close
Set cn = Nothing


There are some problem when i try to change it into VC++ .net format
Set cn = New ADODB.Connection < ---- i cannot new it by using cn = new
ADODB::Connection
cat.Tables("Authors").Name = "Authors2" < --------   Tables doesnt take

any argument

Moreover
Dim cat As ADOX.Catalog  <  ----Interop::ADOX::Catalog *cat  it is work


Set cat = New ADOX.Catalog <------ cat = new Interop::ADOX::Catalog it
dont work, it said error C3153: 'Interop::ADOX::Catalog': you cannot
create an instance of an interface


Is anyone try it before , please give me some guidance on changing the
above code into VC++ .net . Thanks

AddThis Social Bookmark Button