Solved

Using TQuery, get Return code from SQL Server

Posted on 2000-02-29
4
435 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
  • 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: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering 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
proper way to parse text with delphi 7 137
Using idhttp to login to instagram 2 106
URL for downloading Google Chrome for Win XP 2 182
How to build JSON File in Delphi 6 3 44
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…
Microsoft Active Directory, the widely used IT infrastructure, is known for its high risk of credential theft. The best way to test your Active Directory’s vulnerabilities to pass-the-ticket, pass-the-hash, privilege escalation, and malware attacks …

791 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