?
Solved

Using TQuery, get Return code from SQL Server

Posted on 2000-02-29
4
Medium Priority
?
440 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 200 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses
Course of the Month8 days, 13 hours left to enroll

764 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