Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > DB-Aware

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 12-04-2000, 03:14 AM
N/A
Guest
 
Posts: n/a
Default Getting the resultset from a TStoredProc into DBGrid

Hi.

Does anyone know how to get the resultset returned by a stored procedure in MS Access '97 into DBGrid?

The stored procedure contains one input parameter for search.

I'm quite new into Delphi, so please explain...

Mads
Reply With Quote
  #2  
Old 12-04-2000, 06:35 AM
N/A
Guest
 
Posts: n/a
Default RE: Getting the resultset from a TStoredProc into DBGrid

Use a TDataSource and assign the TSroredProc dataset as the DataSet.
To run, assign a value to the params, Open the dataset. If you set the datasource property of the dbgrid, you should see data in your dbgrid.
Reply With Quote
  #3  
Old 12-04-2000, 11:36 PM
N/A
Guest
 
Posts: n/a
Default RE: RE: Getting the resultset from a TStoredProc into DBGrid

Thanks, but I can't get it work right. I've posted the code here:

Begin
StoredProc1.StoredProcName := 'Søg';
StoredProc1.ParamByName('BySoeg').AsString := 'p*';
StoredProc1.Prepare;
StoredProc1.ExecProc;

DataSource1.dataset := StoredProc1;
DBGrid1.DataSource := DataSource1;
end;

The database is MSAccess '97. The stored procedure have one input parameter and is supposed to return a resultset:

SELECT * FROM [Table] WHERE [Field1] LIKE [Parameter];

I'm quite new into Delphi, so please explain...!

--
Mads
Reply With Quote
  #4  
Old 12-05-2000, 04:53 AM
N/A
Guest
 
Posts: n/a
Default RE: RE: RE: Getting the resultset from a TStoredProc into DBGrid

In order to see the results in a grid, do not use ExecProc.

You must use
.Active:=True;
or
.Open;

The stored procedure must then have a result set to return. You must use ExecProc for stored procedures that do not have result sets, like update, insert etc.

Stephan
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 04:12 PM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2013, vBulletin Solutions, Inc.