码迷,mamicode.com
首页 > 数据库 > 详细

DBExpress动态连接SQL-Server

时间:2019-03-24 09:17:29      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:ror   message   动态   err   local   driver   ram   ola   isolation   

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;

DBExpress动态连接SQL-Server

标签:ror   message   动态   err   local   driver   ram   ola   isolation   

原文地址:https://www.cnblogs.com/jijm123/p/10586770.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!