473,396 Members | 2,036 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

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

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 ;-)
Nov 15 '05 #1
1 2970
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]
- mv*@spam.guard.caspershouse.com

"scj" <sc**************@free.fr> wrote in message
news:3f***********************@news.free.fr...
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 ;-)

Nov 15 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Dan | last post by:
I've run into an interesting problem, and seemed to have stumped 3 newsgroups and 2 other forums. For some reason when I try to insert a record into a SQL table that has a Text column, the...
3
by: J. Muenchbourg | last post by:
while inserting new records into SQL, i'm using the folloinwg sqlstatement> Dim MySQL as string = "Insert into roster (pname, pnotes, thedate) values (@pname, @pnotes, @thedate)" the sql...
14
by: Sean C. | last post by:
Helpful folks, Most of my previous experience with DB2 was on s390 mainframe systems and the optimizer on this platform always seemed very predictable and consistent. Since moving to a WinNT/UDB...
22
by: James Cane | last post by:
Here's an interesting problem that someone might have an answer to... Some time ago, I wrote a set of utility classes which wrap up the custom row source function needed to add arbitrary items to...
2
by: Brian Henry | last post by:
is there info about data type conversions between access to ado.net? I have tried a lot of the ones that say oledb data types should work for and get a lot of "data type mismatch" errors using...
1
by: scj | last post by:
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 : ...
13
by: mfreeman | last post by:
The minimal code (VB.NET 2003) needed to show this problem is shown below. All I do is loop through the records in the table and update them without making any changes. Out of 600 records, about...
7
by: =?Utf-8?B?QVRT?= | last post by:
HOWTO Run multiple SQL statements from ASP/ADO to an Oracle 10g. Please help, I'm trying to write an ASP page to use ADO to run a long query against an Oracle 10g database, to create tables,...
9
by: =?Utf-8?B?TWlrZTk5MDA=?= | last post by:
I save a number in the table and want to get that number again, but the number I get has lower precision than I expect. For example, when I divide 10/3 I get 3.3333333333333335 if the variable is...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.