用dbExpress页的SQLConnection1连接sql server2000怎么设置。 [问题点数:0分]

时间:2022-08-14 00:27:57

在d7或者c6已经支持了。
贡献一下我的代码吧:
dbeConn:= TSQLConnection.Create(nil);
      dbeConn.Params.Clear;
      dbeConn.Params.Values['DriverName']:= 'MSSQL';
      dbeConn.Params.Values['HostName']:= FDataSource.address;
      dbeConn.Params.Values['Database']:= FDataSource.serviceName;
      dbeConn.Params.Values['USER_NAME']:= FDataSource.userName;
      dbeConn.Params.Values['Password']:= FDataSource.passWord;
      dbeConn.Params.Values['BlobSize']:= '-1';
      dbeConn.Params.Values['ErrorResourceFile']:= '';
      dbeConn.Params.Values['LocaleCode']:= '0000';
      dbeConn.Params.Values['MSSQL TransIsolation']:= 'ReadCommited';
      dbeConn.Params.Values['OS Authentication']:= 'False';
      randomize;
      dbeConn.ConnectionName:= 'hwsycmss' + Trim(IntToStr(random(99999)));
      dbeConn.DriverName:= 'MSSQL';
      dbeConn.GetDriverFunc:= 'getSQLDriverMSSQL';
      dbeConn.VendorLib:= 'oledb';
      dbeConn.LibraryName:= 'dbexpmss.dll';
      dbeConn.SQLHourGlass:= true;
      dbeConn.KeepConnection:= false;
      try
        dbeConn.Open;
        FActived:= true;
        Result:= true;
        err.SetMessage('MSSQL database Connected OK!',0);
        exit;
      except
        On E:Exception do
        begin
          err.SetMessage('MSSQL Database Connected Failed!' + E.Message,8003);
          FActived:= false;
          Result:= false;
          exit;
        end;
      end;