CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Aug 2000
    Location
    Rotterdam, Netherlands
    Posts
    115

    How to get last creation date from database

    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


  2. #2
    Join Date
    Aug 2000
    Location
    Rotterdam, Netherlands
    Posts
    115

    Re: How to get last creation date from database

    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

    (((


  3. #3
    Join Date
    Aug 2000
    Location
    KY
    Posts
    766

    Re: How to get last creation date from database

    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

  4. #4
    Join Date
    Aug 2000
    Location
    Rotterdam, Netherlands
    Posts
    115

    Re: How to get last creation date from database

    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?



  5. #5
    Join Date
    Aug 2000
    Location
    KY
    Posts
    766

    Re: How to get last creation date from database

    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured