Solved

Using TQuery, get Return code from SQL Server

Posted on 2000-02-29
4
425 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
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…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

771 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

9 Experts available now in Live!

Get 1:1 Help Now