Solved

retrieving parameters from sql server's stored procedure

Posted on 2001-08-08
5
129 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
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

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

758 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now