Board index » delphi » MS SQL Server 6.5, Stored Procedures, Temp Tables and Delphi 4 C/S

MS SQL Server 6.5, Stored Procedures, Temp Tables and Delphi 4 C/S

I am new to the Delphi environment, but familiar with the MS SQL server.
I have spent some time with my nose in online help and a few books, but
I am unable to find a few key sets of information. First, I am trying to
find out how to call out a stored procedure on the backend from Delphi 4
C/S. Basically from Object Pascal code on a particular event on the
front end. My rationale is to have only a reference from the front end
to the back end to process the request. I want the entire SQL processing
to be completed on the back end and returned to Delphi in the form of a
temp table.  Once the data is in the temp table from the stored
procedure, how will the data elements recognize the temp table to
correctly populate a dbgrid or another similar control? An example and
explanation would be helpful to help me resolve this gap in the
application!

Thank you in advance,
Jeremy
Jkad...@eyestreet.com

 

Re:MS SQL Server 6.5, Stored Procedures, Temp Tables and Delphi 4 C/S


Quote
Jeremy Kadlec wrote:

> I am new to the Delphi environment, but familiar with the MS SQL server.
> I have spent some time with my nose in online help and a few books, but
> I am unable to find a few key sets of information. First, I am trying to
> find out how to call out a stored procedure on the backend from Delphi 4
> C/S. Basically from Object Pascal code on a particular event on the
> front end. My rationale is to have only a reference from the front end
> to the back end to process the request. I want the entire SQL processing
> to be completed on the back end and returned to Delphi in the form of a
> temp table.  Once the data is in the temp table from the stored
> procedure, how will the data elements recognize the temp table to
> correctly populate a dbgrid or another similar control? An example and
> explanation would be helpful to help me resolve this gap in the
> application!

> Thank you in advance,
> Jeremy
> Jkad...@eyestreet.com

The use of the #Temp_Table is proprietary to the Stored Procedure, and
MS SQL Server.

Delphi and/or the BDE, are only interested in what the Stored Procedure
returns as a result set.

(*
Note how you do your SELECTS in the Stored Procedures.
if you don't use "SELECT INTO" inside the stored procedure before you do
your   final SELECT, the stored procedure can return multiple result
sets the the   BDE is incapable of indexing, so you will expecting one
result set and   getting another upstream
*)

So the Delphi app will if neccessary pass in params to the stored
procedure, and then open it (if the stored procedure is to return a
result set) or ExecProc if the stored procedure does not return a result
set.

So all your processing and business rules can take place on the Server
side, while the application awaits a response on the client side.

If you need some examples in Delphi for executing and returning result
sets
let me know..

HTH

Rkr

--

                   \|||/
                   /'^'\
                  ( 0 0 )
--------------oOOO--(_)--OOOo--------------
. Reid Roman                              .
. Delphi Programmer                       .
. TVisualBasic:=class(None)               .
. May the Source be With You              .
-------------------------------------------
. Auto-By-Tel (http://www.autobytel.com)  .
. Irvine, CA U.S.A                        .
. E-Mail : rkroman (at) home (dot) com    .
-------------------------------------------

Re:MS SQL Server 6.5, Stored Procedures, Temp Tables and Delphi 4 C/S


Ried,
Thank you very much for the response! You have helped me to move in the
correct direction. If possible could you provide an example or two from
Delphi? So far I am under the impression that I must use the TStoredProc
component and set the database name, stored procedure name on the sql server
and parameters in Delphi. Could you give an example of the parameters and the
necessary settings to have the result set point to the DBgrid gui component.
Also off the top of your head could you list some of the most used methods
with db development with Delphi.

Thank you very much,
Jeremy

Quote
Reid Roman wrote:
> Jeremy Kadlec wrote:

> > I am new to the Delphi environment, but familiar with the MS SQL server.
> > I have spent some time with my nose in online help and a few books, but
> > I am unable to find a few key sets of information. First, I am trying to
> > find out how to call out a stored procedure on the backend from Delphi 4
> > C/S. Basically from Object Pascal code on a particular event on the
> > front end. My rationale is to have only a reference from the front end
> > to the back end to process the request. I want the entire SQL processing
> > to be completed on the back end and returned to Delphi in the form of a
> > temp table.  Once the data is in the temp table from the stored
> > procedure, how will the data elements recognize the temp table to
> > correctly populate a dbgrid or another similar control? An example and
> > explanation would be helpful to help me resolve this gap in the
> > application!

> > Thank you in advance,
> > Jeremy
> > Jkad...@eyestreet.com

> The use of the #Temp_Table is proprietary to the Stored Procedure, and
> MS SQL Server.

> Delphi and/or the BDE, are only interested in what the Stored Procedure
> returns as a result set.

> (*
> Note how you do your SELECTS in the Stored Procedures.
> if you don't use "SELECT INTO" inside the stored procedure before you do
> your   final SELECT, the stored procedure can return multiple result
> sets the the   BDE is incapable of indexing, so you will expecting one
> result set and   getting another upstream
> *)

> So the Delphi app will if neccessary pass in params to the stored
> procedure, and then open it (if the stored procedure is to return a
> result set) or ExecProc if the stored procedure does not return a result
> set.

> So all your processing and business rules can take place on the Server
> side, while the application awaits a response on the client side.

> If you need some examples in Delphi for executing and returning result
> sets
> let me know..

> HTH

> Rkr

> --

>                    \|||/
>                    /'^'\
>                   ( 0 0 )
> --------------oOOO--(_)--OOOo--------------
> . Reid Roman                              .
> . Delphi Programmer                       .
> . TVisualBasic:=class(None)               .
> . May the Source be With You              .
> -------------------------------------------
> . Auto-By-Tel (http://www.autobytel.com)  .
> . Irvine, CA U.S.A                        .
> . E-Mail : rkroman (at) home (dot) com    .
> -------------------------------------------

Other Threads