Solved

retrieving parameters from sql server's stored procedure

Posted on 2001-08-08
5
135 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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

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

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
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…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Suggested Courses
Course of the Month11 days, 15 hours left to enroll

623 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