我现在想要知道如何用INI文件与ORACLE数据库连接,SQL语句应该怎么写呢?INI文件里面应该有些什么内容?

解决方案 »

  1.   

    Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
    Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
    Function GetFromINI(sSection As String, sKey As String, sDefault As String, sIniFile As String)
        Dim sBuffer As String, lRet As Long
        ' Fill String with 255 spaces
        sBuffer = String$(255, 0)
        ' Call DLL
        lRet = GetPrivateProfileString(sSection, sKey, "", sBuffer, Len(sBuffer), sIniFile)
        If lRet = 0 Then
            ' DLL failed, save default
            If sDefault <> "" Then AddToINI sSection, sKey, sDefault, sIniFile
            GetFromINI = sDefault
        Else
            ' DLL successful
            ' return string
            GetFromINI = Left(sBuffer, InStr(sBuffer, Chr(0)) - 1)
        End If
    End Function'// Returns True if successful. If section does not
    '// exist it creates it.
    Function AddToINI(sSection As String, sKey As String, sValue As String, sIniFile As String) As Boolean
        Dim lRet As Long
        ' Call DLL
        lRet = WritePrivateProfileString(sSection, sKey, sValue, sIniFile)
    End Function