unit Unit13;
interface
uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Data.DB, DBAccess, Uni, Vcl.StdCtrls, AeroButtons, MemDS, Vcl.Grids, AdvObj, BaseGrid, AdvGrid, DBAdvGrid, UniProvider, MySQLUniProvider;
type TForm13 = class(TForm) con1: TUniConnection; btn1: TAeroButton; unqry2: TUniQuery; dbdvgrd1: TDBAdvGrid; ds1: TUniDataSource; mysqlnprvdr1: TMySQLUniProvider; btn2: TButton; procedure btn1Click(Sender: TObject); procedure btn2Click(Sender: TObject); private { Private declarations } public { Public declarations } end;
var Form13: TForm13;
implementation
{$R *.dfm}
procedure TForm13.btn1Click(Sender: TObject); begin con1.ProviderName := 'MySQL'; con1.Username := 'root'; con1.Password := '123456'; con1.Server := 'localhost'; con1.Port := 3306; con1.Database := 'wms'; con1.SpecificOptions.Values['Charset'] := 'GBK'; con1.Open;
if con1.Connected then ShowMessage('连接mysql成功!'); end;
procedure TForm13.btn2Click(Sender: TObject); begin self.unqry2.Execute; end;
end.
|
请发表评论