Solved

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

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

Netscaler Common Configuration How To guides

If you use NetScaler you will want to see these guides. The NetScaler How To Guides show administrators how to get NetScaler up and configured by providing instructions for common scenarios and some not so common ones.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

770 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