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

S

scj

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=Microsoft.Jet.OLEDB.4.0;Data
Source=xxx.mdb;Persist Security Info=False" )
oCnx.Open()
....
oDT = oCnx.GetOleDbSchemaTable( oGUID.Columns, New Object() { Nothing,
Nothing, "TABLE_NAME" } )
....

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

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

The problem with Access 97 is that the "COLUMN_FLAGS" 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 ;-)
 
N

Nicholas Paldino [.NET/C# MVP]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top