📄 untpub.pas
字号:
unit untpub;
interface
uses
Classes, SysUtils, IWAppForm, IWApplication, IWTypes, IWCompButton,
Controls, Forms, untframe, DB, ADODB, IWCompEdit, IWHTMLControls,
IWCompLabel, IWVCLBaseControl, Graphics,IWBaseControl, IWControl, IWGrids,
IWDBGrids, IWBaseHTMLControl;
type
Tfrmpub = class(TIWAppForm)
IWLabel1: TIWLabel;
IWHRule1: TIWHRule;
IWLabel2: TIWLabel;
IWLabel3: TIWLabel;
IWLabel4: TIWLabel;
IWLabel5: TIWLabel;
ADOQuery1: TADOQuery;
DataSource1: TDataSource;
IWFrame11: TIWFrame1;
IWLabel7: TIWLabel;
IWButton1: TIWButton;
IWButton2: TIWButton;
IWButton3: TIWButton;
IWButton4: TIWButton;
IWButton5: TIWButton;
IWButton6: TIWButton;
IWEdit1: TIWEdit;
IWEdit2: TIWEdit;
IWEdit3: TIWEdit;
IWButton9: TIWButton;
IWDBGrid1: TIWDBGrid;
IWEdit4: TIWEdit;
IWEdit6: TIWEdit;
btnfirst: TIWButton;
btnlast: TIWButton;
btnprior: TIWButton;
btnnext: TIWButton;
procedure IWAppFormCreate(Sender: TObject);
procedure IWDBGrid1Columns0Click(ASender: TObject;
const AValue: String);
procedure GoFish(const name: string);
procedure IWDBGrid1RenderCell(ACell: TIWGridCell; const ARow,
AColumn: Integer);
procedure IWButton5Click(Sender: TObject);
procedure IWButton6Click(Sender: TObject);
procedure IWButton4Click(Sender: TObject);
procedure IWButton1Click(Sender: TObject);
procedure IWButton2Click(Sender: TObject);
procedure IWButton3Click(Sender: TObject);
procedure ADOQuery1AfterScroll(DataSet: TDataSet);
procedure IWButton9Click(Sender: TObject);
procedure btnfirstClick(Sender: TObject);
procedure btnpriorClick(Sender: TObject);
procedure btnnextClick(Sender: TObject);
procedure btnlastClick(Sender: TObject);
public
end;
implementation
uses untluru, ServerController;
{$R *.dfm}
procedure Tfrmpub.IWAppFormCreate(Sender: TObject);
begin
adoquery1.ConnectionString := 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+strglob+';Persist Security Info=False';
adoquery1.Open ;
iwedit1.Text:=adoquery1.fieldbyname('Name').AsString;
iwedit2.Text:=adoquery1.fieldbyname('Zipcode').AsString;
iwedit3.Text:=adoquery1.fieldbyname('Seller').AsString;
iwedit4.Text:=adoquery1.fieldbyname('Address').AsString;
iwedit6.Text:=adoquery1.fieldbyname('Email').AsString;
end;
procedure Tfrmpub.IWDBGrid1Columns0Click(ASender: TObject;
const AValue: String);
begin
GoFish(AValue);
end;
procedure Tfrmpub.GoFish(const name: string);
begin
adoquery1.open;
adoquery1.Locate('Name', name, []);
end;
procedure Tfrmpub.IWDBGrid1RenderCell(ACell: TIWGridCell; const ARow,
AColumn: Integer);
begin
if ARow = -1 then
begin
ACell.BGColor := clSilver;
if AColumn = 0 then begin
ACell.Font.Color := clBLUE;
adoquery1.Open;
ACell.Text := IntToStr(adoquery1.RecordCount) + ' record found.';
end;
end
else if iwdbgrid1.RowIsCurrent then begin
ACell.BGColor := clYellow;
end;
end;
procedure Tfrmpub.IWButton5Click(Sender: TObject);
begin
adoquery1.open;
adoquery1.Prior;
end;
procedure Tfrmpub.IWButton6Click(Sender: TObject);
begin
adoquery1.open;
adoquery1.Next;
end;
procedure Tfrmpub.IWButton4Click(Sender: TObject);
begin
adoquery1.open;
adoquery1.Cancel;
iwedit1.Text:=adoquery1.fieldbyname('Name').AsString;
iwedit2.Text:=adoquery1.fieldbyname('Zipcode').AsString;
iwedit3.Text:=adoquery1.fieldbyname('Seller').AsString;
iwedit4.Text:=adoquery1.fieldbyname('Address').AsString;
iwedit6.Text:=adoquery1.fieldbyname('Email').AsString;
end;
procedure Tfrmpub.IWButton1Click(Sender: TObject);
begin
adoquery1.Close;
iwedit1.Clear;
iwedit2.Text:='';
iwedit3.Text:='';
iwedit4.Text:='';
iwedit6.Text:='';
iwedit1.SetFocus;
end;
procedure Tfrmpub.IWButton2Click(Sender: TObject);
begin
adoquery1.open;
adoquery1.delete;
adoquery1.Edit;
adoquery1.Post;
iwedit1.Text:=adoquery1.fieldbyname('Name').AsString;
iwedit2.Text:=adoquery1.fieldbyname('Zipcode').AsString;
iwedit3.Text:=adoquery1.fieldbyname('Seller').AsString;
iwedit4.Text:=adoquery1.fieldbyname('Address').AsString;
iwedit6.Text:=adoquery1.fieldbyname('Email').AsString;
end;
procedure Tfrmpub.IWButton3Click(Sender: TObject);
var
str1,str2,str3,str4,str5 :string;
begin
str1:=trim(iwedit1.Text);
str2:=trim(iwedit2.Text);
str3:=trim(iwedit3.Text);
str4:=trim(iwedit4.Text);
str5:=trim(iwedit6.Text);
if (length(str1)=0)then
begin
webapplication.ShowMessage('请输入出版社名')
end
else
{
if (length(str4)=0) then
begin
webapplication.ShowMessage('请输入联系地址')
end
else
}
begin
adoquery1.open;
if adoquery1.Locate('Name',str1,[]) then
begin
adoquery1.Edit;
adoquery1.fieldbyname('Zipcode').AsString:=str2;
adoquery1.fieldbyname('Seller').AsString:=str3;
adoquery1.fieldbyname('Address').AsString:=str4;
adoquery1.fieldbyname('Email').AsString:=str5;
adoquery1.Post;
iwedit1.Text:=adoquery1.fieldbyname('Name').AsString;
iwedit2.Text:=adoquery1.fieldbyname('Zipcode').AsString;
iwedit3.Text:=adoquery1.fieldbyname('Seller').AsString;
iwedit4.Text:=adoquery1.fieldbyname('Address').AsString;
iwedit6.Text:=adoquery1.fieldbyname('Email').AsString;
end
else
begin
adoquery1.Edit;
adoquery1.Append;
adoquery1.fieldbyname('Name').AsString:=str1;
adoquery1.fieldbyname('Zipcode').AsString:=str2;
adoquery1.fieldbyname('Seller').AsString:=str3;
adoquery1.fieldbyname('Address').AsString:=str4;
adoquery1.fieldbyname('Email').AsString:=str5;
adoquery1.Post;
iwedit1.Text:=adoquery1.fieldbyname('Name').AsString;
iwedit2.Text:=adoquery1.fieldbyname('Zipcode').AsString;
iwedit3.Text:=adoquery1.fieldbyname('Seller').AsString;
iwedit4.Text:=adoquery1.fieldbyname('Address').AsString;
iwedit6.Text:=adoquery1.fieldbyname('Email').AsString;
end;
end;
end;
procedure Tfrmpub.ADOQuery1AfterScroll(DataSet: TDataSet);
begin
iwedit1.Text:=adoquery1.fieldbyname('Name').AsString;
iwedit2.Text:=adoquery1.fieldbyname('Zipcode').AsString;
iwedit3.Text:=adoquery1.fieldbyname('Seller').AsString;
iwedit4.Text:=adoquery1.fieldbyname('Address').AsString;
iwedit6.Text:=adoquery1.fieldbyname('Email').AsString;
end;
procedure Tfrmpub.IWButton9Click(Sender: TObject);
begin
tfrmluru.Create(WebApplication).Show;
Release;
end;
procedure Tfrmpub.btnpriorClick(Sender: TObject);
begin
adoquery1.Open;
adoquery1.MoveBy(-iwdbgrid1.RowLimit );
end;
procedure Tfrmpub.btnnextClick(Sender: TObject);
begin
adoquery1.Open;
adoquery1.MoveBy(iwdbgrid1.RowLimit );
end;
procedure Tfrmpub.btnfirstClick(Sender: TObject);
begin
adoquery1.Open;
adoquery1.First;
end;
procedure Tfrmpub.btnlastClick(Sender: TObject);
begin
adoquery1.Open;
adoquery1.last;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -