Solved

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

Posted on 2006-07-08
3
400 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
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 500 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

792 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