Solved

Using TQuery, get Return code from SQL Server

Posted on 2000-02-29
4
438 Views
Last Modified: 2010-04-04
I'm using Delphi 4.0 and SQL Server 7.0.  The problem is I don't know how to get the return code returned by a stored procedure from SQL Server, using TQuery.

0
Comment
Question by:yurrea
[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
  • 2
4 Comments
 

Expert Comment

by:ellessar
ID: 2571688
As far as I know, you need to use the TStoredproc object for all stored procedure calls. The return value is stored in the params of the object.

Assuming that you have not tried this: If you want to you can try and do an execsql - using a TQuery - and check the return value, but never having done this, I cannot place any faith in whether this will work...
0
 

Author Comment

by:yurrea
ID: 2571754
ellesar:

I'm using TQuery for scalability.  One of the experts told me that for TQuery is more flexible that TStoredProc.  In using TQuery, I use 'open' to get values from my query, and 'execsql' whenever I don't need any feedback from sql server.  However, I'm wondering if I can get the return code from a stored procedure through TQuery.
0
 

Expert Comment

by:ellessar
ID: 2572096
As far as I know, you need to use the TStoredproc object for all stored procedure calls. The return value is stored in the params of the object.

Assuming that you have not tried this: If you want to you can try and do an execsql - using a TQuery - and check the return value, but never having done this, I cannot place any faith in whether this will work...
0
 

Accepted Solution

by:
nitdgrev earned 100 total points
ID: 2599454
Do you require a live datset in your app or is it a readonly result set ?

With TStoredProc's you can return results to Delphi by using the TStoredProc.Open call and when you only want to execute a set of command you use TStoredProc.ExecProc.  The ExecProc enables you to access the return value of the procedure.

Note, in using a Tstoredproc to return a result set you must have the corresponding SELECT statement in the stored procedure.  This has got to be preferable in cases where a Non-Editable resultset is required (for example reporting) because if changes are required they can be done on the server side.  

In the documentation it says that cached updates can be used with TStoredProc's but as yet I haven't tried so I don't know if this is true or not.
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
tidtcpserver connection lost handle 2 122
Delphi: making a BW image transparent 10 136
firemonkey keyboard covers the controls 1 80
How to make Sign in, using Clientdataset? 1 42
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…
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…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
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…

734 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