473,385 Members | 1,582 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,385 software developers and data experts.

Database does not take time value

J M
Hi,

I have a huge problem in an app I'm writing.
I use an OleDbDataset (and OleDbDataTable, and so on, created in the
Component Designer) to add rows to a table.
Three of the columns have Date/Time values.
Column 1 is only a date (time: 0:00), no problem there.
Columns 2&3 are only time (I struggled to extract only the time from a Date,
who the hell came up with the idea of returning the TimeOfDay prop of a
DateTime as a TimeSpan instead of a Date??)

Here comes the problem: In my DataRow object, all data is correct (checked
in QuickWatch), but in my database, the time columns are set to January 1,
2001 0:00.
I tried (among lots of other things, to test if I was doing something wrong)
to pass the literal #5/10/2004 15:32# in one of the columns. in the database
it showed as 5/10/2004 0:00...

When reading dates from existing (that is, data that was already in the
database before, entered in Access), there seems to be no problem....

J Mous
Nov 20 '05 #1
4 989
Hi JM,

A well known item, there is no time value in a database.
So you would use a string or a datatime field where you know that you have
to cut of the date.

I hope this helps anyway?

Cor
Nov 20 '05 #2
J M
But why then can it read values correctly, but not write them?
Is it a bug in the framework??

J Mous

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Hi JM,

A well known item, there is no time value in a database.
So you would use a string or a datatime field where you know that you have
to cut of the date.

I hope this helps anyway?

Cor

Nov 20 '05 #3
Hi JM,

You can write them, however it will always be with the date 1900 01 01 (or
something)

Cor
Nov 20 '05 #4
J M
I found out a way to do it. Thanks for your help!!!
I'll share it with you so if anyone encounters the same problem (quite
likely): This is the solution:

I changed the OleDbType for all date/time columns in the dataset designer to
'time' (instead of dateTime) and in all parameters of all commands that had
to do with the date/time values, I set OleDbType to "Date" instead of
"DBDate"... I don't know which of the two did te job (or both)...

J Mous

(I'm sorry for spelling mistakes. 1/ English is not my primary language. 2/
my H key seems to refuse to do anything most of the time...)
"Cor Ligthert" <no**********@planet.nl> schreef in bericht
news:eK**************@TK2MSFTNGP10.phx.gbl...
Hi JM,

You can write them, however it will always be with the date 1900 01 01 (or
something)

Cor

Nov 20 '05 #5

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

Similar topics

11
by: HolaGoogle | last post by:
hi all, can you please tell me what i should do to avoid session timeout when displaying my database info in my asp form (DisplayUserDatabase.asp)??? ** actualy it does load and display the...
4
by: Jack | last post by:
Hi, I have a checkbox the value which goes to a database via a asp page that builds the sql string. In the front end asp page, the checkbox code is written as follows: <i><input...
2
by: Kums | last post by:
What is the maximum permissible size of a database? Is there any limitation. What is the maximum # of tablespace's allowed in a database? Thanks for your response.
7
by: News | last post by:
Hello, I have to build a program with the future in mind and I need a bit of guidance from a guru or two. My program will start as a multi-user Windows Application built with VB.Net and using an...
29
by: MP | last post by:
Greets, context: vb6/ado/.mdb/jet 4.0 (no access)/sql beginning learner, first database, planning stages (I think the underlying question here is whether to normalize or not to normalize this...
3
by: josh.kuo | last post by:
Sorry about the subject, I can't think of a better one. I recently wrote some PHP classes that I think might be of interest to this group. Since I have been reaping the benefits of reading news...
9
by: Wayne Smith | last post by:
I've come up against a major headache that I can't seem to find a solution for but I'm sure there must be a workaround and I would really be grateful of any help. I'm currently building a web...
5
by: kyosohma | last post by:
Hi, I am populating a mySQL database with data from the MS Access database. I have successfully figured out how to extract the data from Access, and I can insert the data successfully into mySQL...
12
by: nyathancha | last post by:
Hi, I have a question regarding best practices in database design. In a relational database, is it wise/necessary to sometimes create tables that are not related to other tables through a...
30
by: fniles | last post by:
On my machine in the office I change the computer setting to English (UK) so the date format is dd/mm/yyyy instead of mm/dd/yyyy for US. This problem happens in either Access or SQL Server. In the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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,...

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.