adoconsql.script

来自「pas脚本编译,编译写好的脚本,运用了fastscript控件」· SCRIPT 代码 · 共 48 行

SCRIPT
48
字号

procedure c1(sender: TObject);
begin
  msgbox('告诉你一个好消息,你成功了!',0);
 // showmessage('将要退出程序,哈哈!');
 // tform(tbutton(sender).parent).Close;
end;
var
  DBForm: TForm;
  Table: TTable;
  DataSource: TDataSource;
  Grid: TDBGrid;
  bt_OK:tbutton;
   a:Tadoconnection;
  adotb:tadotable;
begin
  DBForm := TForm.Create(nil);
  DBForm.SetBounds(100, 100, 400, 400);
  a:=tadoconnection.create(nil);
  a.ConnectionString :='Driver=SQL Server;UID=sa;PWD=;Server=.;DataBase=webcwdb;';
  a.LoginPrompt :=false;
  a.connected:=true;

  adotb := TadoTable.Create(DBForm);
 // Table.DatabaseName :='E:\软件\Code\delphi-control\FastScript\Demos\DB';
  adotb.connection:=a;
  adotb.readonly:=true;
  adotb.TableName := 'rept';
  adotb.Open;

  DataSource := TDataSource.Create(DBForm);
  DataSource.DataSet := adotb;
  DBForm.caption:='告诉你一个好消息,你成功了!';
  Grid := TDBGrid.Create(DBForm);
  Grid.DataSource := DataSource;
  Grid.Parent := DBForm;
  Grid.Align := alClient;
  bt_ok:=tbutton.create(nil);
  bt_ok.left:=0;
  bt_ok.top:=0;
  bt_ok.Caption:='确定';
  bt_ok.parent:=DBForm ;
  bt_ok.onclick:=@c1;
  DBForm.ShowModal;
  DBForm.Free;
end.

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?