↓ 跳过正文
  1. 文章/

ADO 连接串生成测试工具

·1 分钟·
目录

本工具可用于测试、生成Ado 数据库连接串!

下载
#

🔮 Ado Test

截图
#

Ado Connection String Test

代码
#

Unit1.pas
#

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, DB, ADODB, ADOInt, ADOConst;

type
  TForm1 = class(TForm)
    mmo1: TMemo;
    btn1: TButton;
    btn2: TButton;
    con1: TADOConnection;
    procedure btn1Click(Sender: TObject);
    procedure btn2Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.btn1Click(Sender: TObject);
begin
  con1.Connected := false;
  con1.ConnectionString := PromptDataSource(Handle, mmo1.Text);
   mmo1.Text:=con1.ConnectionString
end;

procedure TForm1.btn2Click(Sender: TObject);
begin
  try
    con1.Connected := false;
    con1.ConnectionString := mmo1.Text;
    con1.Connected := true;
    ShowMessage('OK');
  except
    on E: Exception do
    begin
      ShowMessage(e.Message);
    end;
  end;
end;

end.

Unit1.dfm
#

object Form1: TForm1
  Left = 0
  Top = 0
  BorderStyle = bsDialog
  Caption = 'ADO Test'
  ClientHeight = 269
  ClientWidth = 818
  Color = clBtnFace
  Font.Charset = DEFAULT_CHARSET
  Font.Color = clWindowText
  Font.Height = -11
  Font.Name = 'Tahoma'
  Font.Style = []
  OldCreateOrder = False
  Position = poDesktopCenter
  PixelsPerInch = 96
  TextHeight = 13
  object mmo1: TMemo
    Left = 8
    Top = 8
    Width = 802
    Height = 193
    ScrollBars = ssBoth
    TabOrder = 0
  end
  object btn1: TButton
    Left = 624
    Top = 224
    Width = 75
    Height = 25
    Caption = #26032#24314#36830#25509#20018
    TabOrder = 1
    OnClick = btn1Click
  end
  object btn2: TButton
    Left = 720
    Top = 224
    Width = 75
    Height = 25
    Caption = #27979#35797
    TabOrder = 2
    OnClick = btn2Click
  end
  object con1: TADOConnection
    LoginPrompt = False
    Left = 264
    Top = 152
  end
end

相关文章