Solved

retrieving parameters from sql server's stored procedure

Posted on 2001-08-08
5
134 Views
Last Modified: 2010-04-06
i have a stored procedure with output parameters.
how do i get values returned by the parameters from delphi?

thanks
0
Comment
Question by:sapulidi
[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
5 Comments
 
LVL 6

Accepted Solution

by:
Jaymol earned 50 total points
ID: 6363975
Hi,

To retrieve the values in the output type parameters, use this...

  ReturnedValue:=StoredProc1.ParamByName('ReturnValue').Value;

It's as simple as that.  (Obviously change the 2 variable names to suit.)

John.
0
 
LVL 21

Expert Comment

by:gemarti
ID: 6364071
Have you tried placing a DataSource and Query Component on your Form or DataModule?

In the DataSource Component you will Select Query1 as the dataset.
In the Query Component you would select the DatabaseName (If it's not in the list you'll have to create it from either BDE or ODBC).

Add this SQL Statement to the query1.SQL String List:  SELECT * FROM storedprocedure (:parameter)



0
 
LVL 4

Expert Comment

by:fva
ID: 6367004
In addition to the above:
gemarti's suggestion will work only for DBMS's that return a resultset (e.g. MS-SQL).
If your proc is on Oracle _and_ one of the params is an OUT/INOUT REF CURSOR, then the resultset has to be accessed differently. Treat your stored proc as a dataset and instead of Exec just Open it and use it as a regular dataset. Do not forget to close it at the end.

F.
0
 
LVL 26

Expert Comment

by:Russell Libby
ID: 8741578
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Accept Jaymol's comment as answer

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Thank you,
Russell

EE Cleanup Volunteer
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

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

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Are you ready to implement Active Directory best practices without reading 300+ pages? You're in luck. In this webinar hosted by Skyport Systems, you gain insight into Microsoft's latest comprehensive guide, with tips on the best and easiest way…

752 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