i have a simple SELECT stored procedure (MS SQL Server)that takes in one parameter and returns values from a DB table
On executing the SP from the Database side, It works perfectly.
I got to load the results from the SP into a list box on mysearch form (DELPHI). i want to load the listbox value selected back to the main form.
How do i pass the results from the mysearch form back to the main form
STORED PROC CODE:
CREATE PROCEDURE CLIENTFINDER @selcname varchar (25)
AS
SELECT Clientname, Company, Title, Address, Town
FROM [portfolio].[dbo].[ADVCLIENT]
WHERE clientname LIKE @selcname + '%'
GO
DELPHI CODE:
procedure TFrmFindClient.BtnFindClick(Sender: TObject);
begin
//if u click the find button having entered text
with DModStocks.ADOSPFindClient do
begin
Close;
Parameters.ParamByName('@selcname').Value := EditFind.Text;
Open;
Active := True;
ShowMessage(Format('Number of records returned is %d', [RecordCount]));
// code to populate the list box once i get values from dataset
while not Eof do
begin
LBoxFind.Items.Add(Fields[0].AsString);
Next;
end;
end;
end;
Thanx :
Kagee
(Delphi beginner)
On executing the SP from the Database side, It works perfectly.
I got to load the results from the SP into a list box on mysearch form (DELPHI). i want to load the listbox value selected back to the main form.
How do i pass the results from the mysearch form back to the main form
STORED PROC CODE:
CREATE PROCEDURE CLIENTFINDER @selcname varchar (25)
AS
SELECT Clientname, Company, Title, Address, Town
FROM [portfolio].[dbo].[ADVCLIENT]
WHERE clientname LIKE @selcname + '%'
GO
DELPHI CODE:
procedure TFrmFindClient.BtnFindClick(Sender: TObject);
begin
//if u click the find button having entered text
with DModStocks.ADOSPFindClient do
begin
Close;
Parameters.ParamByName('@selcname').Value := EditFind.Text;
Open;
Active := True;
ShowMessage(Format('Number of records returned is %d', [RecordCount]));
// code to populate the list box once i get values from dataset
while not Eof do
begin
LBoxFind.Items.Add(Fields[0].AsString);
Next;
end;
end;
end;
Thanx :
Kagee
(Delphi beginner)