📄 js310unit.pas
字号:
unit JS310Unit;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, PublicUnit, jpeg, ExtCtrls, DBCtrls, StdCtrls, Grids, DBGrids;
type
TJS310Form = class(TPublicUnit)
DBGrid1: TDBGrid;
Panel1: TPanel;
Label2: TLabel;
ComboBox1: TComboBox;
Button7: TButton;
Button8: TButton;
Button9: TButton;
DBNavigator1: TDBNavigator;
procedure ComboBox1DropDown(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
JS310Form: TJS310Form;
implementation
uses DMUnit;
{$R *.dfm}
procedure TJS310Form.ComboBox1DropDown(Sender: TObject);
var
I: Integer;
begin
inherited;
combobox1.Clear;
with DM.Querytemp do
begin
SQL.clear;
SQl.Text := 'select 结算单位 from 结算分单 ';
Close;
Active := False;
prepared := False;
prepared := True;
Active := True;
if (recordcount > 0) then
first;
for i := 0 to recordcount - 1 do
begin //取得该列所有的数据到combobox2控件中
combobox1.Items.add(FieldByName('结算单位').asstring);
next;
end;
end;
end;
procedure TJS310Form.Button9Click(Sender: TObject);
begin
inherited;
Close;
end;
procedure TJS310Form.Button7Click(Sender: TObject);
begin
inherited;
{--- 判断搜索的条件是否为空 ---}
if Combobox1.Text <> '' then
begin
with DM.Querytemp do
begin
SQL.Clear;
SQl.Text := 'select * from 结算分单 where 结算单位 like '
+ #39 + '%' + trim(combobox1.Text) + '%' + #39;
Close;
Active := False;
prepared := False;
prepared := True;
Active := True;
open;
DBGrid1.DataSource := DM.dsQuerytemp;
DBNavigator1.DataSource := DM.dsQuerytemp;
end;
end
else
MessageBox(0, '搜寻条件错误', '错误', MB_OK + MB_ICONSTOP);
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -