⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 kqglcommon.pas

📁 考勤管理系统很有借鉴的饿意义
💻 PAS
字号:
unit KqglCommon;

interface

uses
  Windows, SysUtils, Registry, DB, DBGrids;

resourcestring
  conKqglDataFile = 'Data\Kqgl.mdb';

var
  EXEPath: string;  //主程序路径

function GetExePath: string;
function Create_ODBC_Access(const ODBCName: string): boolean;

implementation

function GetExePath: string;
begin
  Result := ExtractFilePath(ParamStr(0));
end;

function Create_ODBC_Access(const ODBCName: string): boolean;
var
  RegisterTemp : TRegistry;
  SystemPath: array [0..255] of char;
  StrSystemPath: string;
begin
  Result := False;

  RegisterTemp := TRegistry.Create;
  with RegisterTemp do
  begin
    RootKey := HKEY_LOCAL_MACHINE;
    if OpenKey('Software\ODBC\ODBC.INI\ODBC Data Sources', True) = False then
      CloseKey
    else
      begin
        WriteString(ODBCName, 'Microsoft Access Driver (*.mdb)');
        CloseKey;
        if OpenKey('Software\ODBC\ODBC.INI\' + ODBCName, True) then
        begin
          GetSystemDirectory(SystemPath, 255);
          StrSystemPath := SystemPath;
          StrSystemPath := Trim(StrSystemPath);

          WriteString( 'DBQ', EXEPath + conKqglDataFile );
          WriteString( 'Driver', StrSystemPath + '\odbcjt32.dll' );
          WriteInteger( 'DriverId', 25 );
          WriteString( 'FIL', 'MS Access;' );
          WriteInteger( 'SafeTransactions', 0 );
          WriteString( 'UID', '' );
          CloseKey;

          Result := True;
        end;
      end;
    Free;
  end;
end;

end.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -