procedure TForm1.Button1Click(Sender: TObject);
var
  theCNN : TSQLConnection;//定义连接,要引用 DB, SqlExpr
begin
  theCNN := TSQLConnection.Create(self);
  theCNN.LoginPrompt := False;//关闭登入窗口
  theCNN.Params.Clear;
  theCNN.DriverName:='MSSQL';
  theCNN.GetDriverFunc:='getSQLDriverMSSQL';
  theCNN.LibraryName:='dbexpmss.dll';
  theCNN.VendorLib:='oledb';
  //--------下面设置连接叁数-----------
  theCNN.Params.Append('SchemaOverride=sa.dbo');
  theCNN.Params.Append('DriverName=MSSQL');
  theCNN.Params.Append('HostName=LocalHost\MSSQL'); //这是我SQL_Server服务器名
  theCNN.Params.Append('DataBase=KinSunKTV'); //SQL_Server数据库名称
  theCNN.Params.Append('User_Name=sa');  //SQL_Server用户名
  theCNN.Params.Append('Password=kinsun');//SQL_Server密码
  theCNN.Params.Append('BlobSize=-1');
  theCNN.Params.Append('ErrorResourceFile= ');
  theCNN.Params.Append('LocaleCode=0000');
  theCNN.Params.Append('MSSQL TransIsolation=ReadCommited');
  theCNN.Params.Append('OS Authentication=False');
  theCNN.Open;
  ShowMessage('连接成功');
end;

相关文章:

  • 2021-12-05
  • 2021-08-14
  • 2021-08-05
  • 2022-12-23
  • 2021-07-16
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-06-30
  • 2021-11-25
  • 2022-02-09
  • 2022-01-18
相关资源
相似解决方案