procedure TformDtl.IWAppFormCreate(Sender: TObject);
var
i : integer;
begin
i := 0;
with Query1 do
begin
//SQL文設定
Active := False;
SQL.Clear;
SQL.Add('SELECT * FROM SHOHIN');
SQL.Add('WHERE NAME LIKE :pNAME');
if UserSession.SRC_BUNRUI <> 0 then //「すべての商品」以外
begin
SQL.Add('AND KBN = :pKBN');
ParamByName('pKBN').AsString := IntToStr(UserSession.SRC_BUNRUI);
end;
ParamByName('pNAME').AsString := '%' + UserSession.SRC_WORD + '%';
Active := True;
First;
//IWGridを設定
while not eof do
begin
IWGrid1.RowCount := i + 1;
//商品コード
IWGrid1.Cell[i,0].Text := FieldByName('CODE').AsString;
//商品名
IWGrid1.Cell[i,1].Text := FieldByName('NAME').AsString;
//商品画像(画像ファイル名:「商品コード.jpg」)
IWGrid1.Cell[i,2].Text := '<img src="C://img/'
+ FieldByName('CODE').AsString
+ '.jpg" width="50" height="50">';
IWGrid1.Cell[i,2].Width := '55';
IWGrid1.Cell[i,2].Height:= '55';
IWGrid1.Cell[i,2].Alignment:= taCenter; //中央揃え
Next;
i := i + 1;
end;
Active := False;
end;
end;
|