Solved

converting datetime to stop sql error?

Posted on 2013-06-26
8
502 Views
Last Modified: 2013-09-06
HI:
I have a little delphi program interrogating an mssql database.
I have a calendar control but when I select a date I get a sql error "DateTime field overflow. Fractional second precision exceeds the scale specified in the parameter binding." Which I took to mean that I am trying to filter a date with a date time?
Attached sql query sets out what I think the issue is. field 'datet' in 'vvdates' is datetime. Field 'ordered' in 'goorders' is a date.
Having said all of that the program actually works on the PC on which I am writing the program. It fails on any other PC with the sql error as described. I have checked the ODBC links and BDE on all PC's and they look the same. Has anybody experience of this?
Thanks!
delphidate.txt
0
Comment
Question by:ClaytonGlass
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 22

Expert Comment

by:Ferruccio Accalai
ID: 39278172
First of all I'd stop using odbc for MSSql. You could simply use ADO  to connect directly using the OS native engine

Anyway try using DateTimePicker.date instead of Datetimepicker.datetime.
0
 

Author Comment

by:ClaytonGlass
ID: 39278231
Thanks for that. I tried date and got 'invalid date format message'. Will look at ADO.
0
 
LVL 32

Expert Comment

by:Ephraim Wangoya
ID: 39279079
Try this as well

Query1.ParamByName('SELDATE').AsSqlTimeStamp := DateTimeToSQLTimeStamp(DateTimePicker1.Date);
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

Author Comment

by:ClaytonGlass
ID: 39280508
Thanks ewangoya but get a pascal error  - undeclared identifier. AM using BDS2006 if that helps.
0
 
LVL 27

Accepted Solution

by:
Sinisa Vuk earned 200 total points
ID: 39284543
Try
Query1.ParamByName('SELDATE').AsDatetime := Trunc(DateTimePicker1.Date); 

Open in new window

0
 
LVL 37

Expert Comment

by:Geert Gruwez
ID: 39470066
I've requested that this question be deleted for the following reason:

Not enough information to confirm an answer.
0
 

Author Comment

by:ClaytonGlass
ID: 39470063
I do apologise.
I switched to Ado and then became distracted by a different issue.
Am awarding the points to sinisav as his solution works now.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question