![]() |
|
#1
|
|||
|
|||
|
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 |
|
#2
|
|||
|
|||
|
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. |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||
|
|||
|
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 |
![]() |
| Thread Tools | |
| Display Modes | |
|
|