• FireDAC指定mssql驱动



    bool __fastcall IsWow64()
    {
    //为True时,则是32位的程序运行在64位的系统上,为False时,则是32位程序运行在32位系统上或64位程序运行在64位系统上!
     typedef BOOL (WINAPI *LPFN_ISWOW64PROCESS)(HANDLE,PBOOL);
     LPFN_ISWOW64PROCESS fnIsWow64Process;
     BOOL bIsWow64=FALSE;
     fnIsWow64Process=(LPFN_ISWOW64PROCESS)GetProcAddress(GetModuleHandle(L"kernel32"),"IsWow64Process");
     if(fnIsWow64Process!=NULL)
       {
     if(!fnIsWow64Process(GetCurrentProcess(),&bIsWow64))
       {
        bIsWow64=FALSE;
       }
       }
     if(bIsWow64==FALSE)
       return false;
     else
       return true;
    }

    //---------------------------------------------------------------------------
    UnicodeString __fastcall GetSQLServerNativeClientDll()
    {
     UnicodeString Key,Value,DllName=L"sqlsrv32.dll";
     TStringList *List=new TStringList();
     TRegistry *Registry = new TRegistry();
     Registry->Access=KEY_QUERY_VALUE|KEY_READ;
     Registry->RootKey=HKEY_LOCAL_MACHINE;
     if(IsWow64())
       Key="SOFTWARE\Wow6432Node\ODBC\ODBCINST.INI";
     else
       Key="SOFTWARE\ODBC\ODBCINST.INI";
     if(Registry->KeyExists(Key))
       {
     //ShowMessage(Key);
     Registry->OpenKey(Key,false);
     Registry->GetKeyNames(List);
     for(int i=List->Count;i>0;i--)
       {
        Value=List->Strings[i-1];
        //ShowMessage(Value);                    //
        if(Value.Pos(L"SQL Server Native Client")>0||Value.Pos(L"SQL Native Client")>0)
       {
        Registry->OpenKey(Value,false);
        DllName=Registry->ReadString(L"Driver");
        break;
             }
          }
       }
     Registry->CloseKey();
     delete Registry;
     delete List;
     //ShowMessage(DllName);
     return DllName;
    }
  • 相关阅读:
    UWP开发必备:常用数据列表控件汇总比较
    CodeForces 372 A. Counting Kangaroos is Fun
    ubuntu 13.10 eclipse 菜单栏不可用的问题
    Codeforces Round #219(Div. 2)373 B. Making Sequences is Fun(二分+找规律)
    Git/Github使用方法小记
    Ubuntu 下jdk的安装
    VIM简明教程
    codeforces 371 C-Hamburgers
    codeforces 371A K-Periodic Array
    计算机网络中IP地址和MAC地址
  • 原文地址:https://www.cnblogs.com/suhq/p/10390995.html
Copyright © 2020-2023  润新知