📄 adoconsql.script
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -