Board index » delphi » Inserting Dates and Times into MS-SQL

Inserting Dates and Times into MS-SQL

Ok, well I am starting to pull my hair out.

Using a simple table, with the following fields:

UniqueKey : varchar ;
TheDate   : datetime ;
TheTime   : datetime ;

Using these three fields, let delphi create a simple form, and run it.

If there is an existing record, the date fields functions fine.
which is to say, that blanking the date field, typing in a new
date.  Posting the record is just fine.

Attemtping to change the time, causes SQL server to error out and
insist that an invalid datetime value was attempted in either an
insert or update condition.

Is there a known method of handling these types of errors ?

Thanks in advance....

Bill...

 

Re:Inserting Dates and Times into MS-SQL


Quote
William Sappington (b...@willfly.vip.best.com) wrote:

: Ok, well I am starting to pull my hair out.

: Using a simple table, with the following fields:

: UniqueKey : varchar ;
: TheDate   : datetime ;
: TheTime   : datetime ;

: Using these three fields, let delphi create a simple form, and run it.

: If there is an existing record, the date fields functions fine.
: which is to say, that blanking the date field, typing in a new
: date.  Posting the record is just fine.

: Attemtping to change the time, causes SQL server to error out and
: insist that an invalid datetime value was attempted in either an
: insert or update condition.

: Is there a known method of handling these types of errors ?

: Thanks in advance....

: Bill...

Repace the files w3dblib.dll and dbnmp3.dll with the news version.
All Date/Time//Floatingpoint problems will be gone

/Nils
--
______________________________________________________________________________
     _/    _/  _/    _/  _/_/_/
    _/_/  _/  _/    _/  _/    _/     NHD-Softwaresysteme
   _/  _/_/  _/_/_/_/  _/    _/      Dipl.-Inform. Nils H. Dzubiel
  -/    _/  _/    _/  _/    _/       An der Rossmuehle 15
 _/    _/  _/    _/  _/_/_/          47835 Krefeld - Huels, Germany

                 "What do >you< care, what other people think ?"              

Re:Inserting Dates and Times into MS-SQL


Reposting article removed by rogue canceller.

Quote
William Sappington (b...@willfly.vip.best.com) wrote:

: Ok, well I am starting to pull my hair out.

: Using a simple table, with the following fields:

: UniqueKey : varchar ;
: TheDate   : datetime ;
: TheTime   : datetime ;

: Using these three fields, let delphi create a simple form, and run it.

: If there is an existing record, the date fields functions fine.
: which is to say, that blanking the date field, typing in a new
: date.  Posting the record is just fine.

: Attemtping to change the time, causes SQL server to error out and
: insist that an invalid datetime value was attempted in either an
: insert or update condition.

: Is there a known method of handling these types of errors ?

: Thanks in advance....

: Bill...

Repace the files w3dblib.dll and dbnmp3.dll with the news version.
All Date/Time//Floatingpoint problems will be gone

/Nils
--
______________________________________________________________________________
     _/    _/  _/    _/  _/_/_/
    _/_/  _/  _/    _/  _/    _/     NHD-Softwaresysteme
   _/  _/_/  _/_/_/_/  _/    _/      Dipl.-Inform. Nils H. Dzubiel
  -/    _/  _/    _/  _/    _/       An der Rossmuehle 15
 _/    _/  _/    _/  _/_/_/          47835 Krefeld - Huels, Germany

                 "What do >you< care, what other people think ?"              

Re:Inserting Dates and Times into MS-SQL


Hi Bill,

Quote
You wrote:
> Ok, well I am starting to pull my hair out.

Hope you're not losing it as fast as I am (mine more through old age I
guess - hell, I'm already 30!).

Quote
> Using a simple table, with the following fields:

> UniqueKey : varchar ;
> TheDate   : datetime ;
> TheTime   : datetime ;

> Using these three fields, let delphi create a simple form, and run it.

> If there is an existing record, the date fields functions fine.
> which is to say, that blanking the date field, typing in a new
> date.  Posting the record is just fine.

> Attemtping to change the time, causes SQL server to error out and
> insist that an invalid datetime value was attempted in either an
> insert or update condition.

As developers of a product called ODBCExpress, we came across about
every funny that is in SQL Server.  One thing we did notice in our
experiences is that SQL Server struggles with date/time stamps inserted
by Delphi (particularly the fact the the microseconds are truncated and
inserted as zeroes). This for us is a major problem, considering that
our primary keys are often timestamp fields.

Quote
> Is there a known method of handling these types of errors ?

You should check out ODBCExpress, we handle this kind of thing so
slickly for you!  ODBCExpress is a full replacement for the troublesome
BDE - faster, full-featured and stable, if you're interested, check it
out at

http://www.adam.co.za

Hope this helps.

Regards,

Rob
--
Rob McGillivray
Manager: Client/server Software Development
DataSoft - "Voted Top Development House in South Africa - 1994"

Other Threads