Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Passing Date To Stored procedure for Delphi application as INPUT paramater...

Posted on 2006-07-08
3
Medium Priority
?
436 Views
Last Modified: 2010-04-05
Hi

I am calling interbase/firebird  stored procedures from my delhi apllication to post entries to tables, OR to lookup data for reports.

MY problem is as follows when I SOMETIMES call a stored procedure and pass a date as input paramater then my delphi application falls over.
I get invalid date ("20/05/2005") or other invalid date errors.
My stored procedure recieve a Date Type Varaiable..


WHAT is the correct way to call a stored procedure and to pass a DATE to a stored procedure.
I am currently doing the following..
sQry := Format('execute procedure  SP_GetEmployees "%s",  //The procedure recieve one Date variable as input paramter
           [FormatDateTime('yyyy/mm/dd',Now()));

Please I am not sure which is the correct way to pass a Date, and which is the safest way without delphi falls over.

Thank you
henry
0
Comment
Question by:henryreynolds
[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
3 Comments
 
LVL 13

Expert Comment

by:BlackTigerX
ID: 17065371
that depends on how the sql server is configured, but I think you can use this format

YYYY-MM-DD
0
 
LVL 17

Accepted Solution

by:
TheRealLoki earned 2000 total points
ID: 17067046
The best way would be to use parameters (they start with : ), you then set the parameter by using the .AsDateTime method
eg.
ibsql1.sql.text := 'execute procedure SP_GetEmployees(:ParamSomeDate)';
ibsql1.ParamByName('ParamSomeDate').AsDateTime := Now; // or your date variable
ibslq1.ExecQuery;

or you could always format it as dd-mmm-yyyy which cannot be misunderstood

e.g.
execute procedure SP_GetEmployees('01-Jan-2006')
or
ibsql1.sql.text := 'execute procedure SP_GetEmployees(' + FormatDateTime('dd"-"mmm"-"yyyy', SomeDate) + ')';
0
 
LVL 5

Expert Comment

by:Scay7
ID: 17067610
Sorry for this :

TheRealLoki --->
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_21881726.html

Please reply, you havent replied in almost a month...

Peace Scay7
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

705 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