[ADO.Net, Access 97] how to determine the exact type of DateTime column

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • scj

    [ADO.Net, Access 97] how to determine the exact type of DateTime column

    Hi all,

    I need to determine the exact type of DateTime column(*) in an Access 97
    database.

    I'm able to do this with an Access 2 database.
    With ADO.Net and VB.Net (**), I do something like this :

    Dim oDT As New DataTable()
    Dim oCnx As OleDbConnection
    Dim oGUID As New OleDbSchemaGuid ()
    ....
    oCnx = New OleDbConnection ( "Provider=Micro soft.Jet.OLEDB. 4.0;Data
    Source=xxx.mdb; Persist Security Info=False" )
    oCnx.Open()
    ....
    oDT = oCnx.GetOleDbSc hemaTable( oGUID.Columns, New Object() { Nothing,
    Nothing, "TABLE_NAME " } )
    ....

    Then, the column :
    - "DATA_TYPE" gives the type
    - "COLUMN_FLA GS" gives me more information

    With Access 2, "DATA_TYPE" is "7" for a date and "COLUMN_FLA GS" is "90" for
    a DateTime or something else for just a Date.

    The problem with Access 97 is that the "COLUMN_FLA GS" is the same with both
    Date and DateTime.

    I tryed to use system tables, with the hope to find a table with table
    structure and excat column type, but without succes.

    Thanks for all assistance,

    Marc

    (*) A DateTime can store date, time, datetime, etc...
    (**) You can give me a sample code in C#, it's not a problem ;-)


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: [ADO.Net, Access 97] how to determine the exact type of DateTime column

    scj,

    You might want to use COM interop with ADOX in this situation. It
    ^might^ give you the level of detail you need for the columns you want. I
    say might with emphasis because ultimately, they would be accessing the same
    ole-db provider for access, and you would have to hope that ADOX is
    accessing different aspects of the provider than the OleDb provider in .NET.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "scj" <scj.informatiq ue@free.fr> wrote in message
    news:3f8c1525$0 $28879$626a54ce @news.free.fr.. .[color=blue]
    > Hi all,
    >
    > I need to determine the exact type of DateTime column(*) in an Access 97
    > database.
    >
    > I'm able to do this with an Access 2 database.
    > With ADO.Net and VB.Net (**), I do something like this :
    >
    > Dim oDT As New DataTable()
    > Dim oCnx As OleDbConnection
    > Dim oGUID As New OleDbSchemaGuid ()
    > ...
    > oCnx = New OleDbConnection ( "Provider=Micro soft.Jet.OLEDB. 4.0;Data
    > Source=xxx.mdb; Persist Security Info=False" )
    > oCnx.Open()
    > ...
    > oDT = oCnx.GetOleDbSc hemaTable( oGUID.Columns, New Object() { Nothing,
    > Nothing, "TABLE_NAME " } )
    > ...
    >
    > Then, the column :
    > - "DATA_TYPE" gives the type
    > - "COLUMN_FLA GS" gives me more information
    >
    > With Access 2, "DATA_TYPE" is "7" for a date and "COLUMN_FLA GS" is "90"[/color]
    for[color=blue]
    > a DateTime or something else for just a Date.
    >
    > The problem with Access 97 is that the "COLUMN_FLA GS" is the same with[/color]
    both[color=blue]
    > Date and DateTime.
    >
    > I tryed to use system tables, with the hope to find a table with table
    > structure and excat column type, but without succes.
    >
    > Thanks for all assistance,
    >
    > Marc
    >
    > (*) A DateTime can store date, time, datetime, etc...
    > (**) You can give me a sample code in C#, it's not a problem ;-)
    >
    >[/color]


    Comment

    Working...