Click to See Complete Forum and Search --> : How to get last creation date from database


law
November 2nd, 2000, 09:55 AM
Hi there,

I know DAO can get the last creation date from a table through its properties collection, but how can i get this with ADO ?
It must be possible i guess, but just don't know how.
(Maybe via openschems or something?)

Anyway, please help
thanx
Law

law
November 2nd, 2000, 10:06 AM
I tried the following by the way:

Dim d as ADODB.Connection
Dim ca as ADOX.Catalog

set d = new ADODB.Connection
d.ConnectionString = "DSN=Cards"
d.Open

set ca = new ADOX.Catalog
ca.ActiveConnection = d

for x = 0 to ca.Tables.Count - 1
Debug.print ca.Tables(x).DateModified
next x




But it returned all Null

:((((

dfwade
November 2nd, 2000, 10:13 AM
References required ado and the ado ddl and security

Add a command button and try this

private Sub Command1_Click()
me.Caption = TableCreateDate("Authors", "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=false;Data Source=D:\win32app\Microsoft Visual Studio\VB98\Biblio.mdb")
End Sub



public Function TableCreateDate(TableName as string, ConnectString as string) as date
Dim oConnection as Connection
set oConnection = new Connection
oConnection.Open ConnectString
Dim oCatalog as Catalog
set oCatalog = new Catalog
Dim oTable as Table
With oCatalog
set .ActiveConnection = oConnection
TableCreateDate = .Tables(TableName).DateCreated
End With
set oConnection = nothing
set oCatalog = nothing
set oTable = nothing
End Function





TANSTAAFL - There ain't no such thing as a free lunch

law
November 2nd, 2000, 10:29 AM
Tried that... i says invalid use of null because the datecreated property returns Null.

The help says that the provider doesn't support this property if it returns null.

But why can Access read it and i can't?

dfwade
November 2nd, 2000, 10:47 AM
What database are you connecting to. I tried access and it works. I tried Oracle and it doesn't becuase the driver does not support this feature.

TANSTAAFL - There ain't no such thing as a free lunch