Solved

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

Posted on 2006-07-08
3
406 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 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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
When i run adoquery my application freezes 26 188
How to build JSON File in Delphi 6 3 70
DBCtrlGrid, Delphi, Scroll 8 56
Delphi Firemonkey send email on Android 1 38
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…
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…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

740 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