Custom connection string

xiaoxiao2021-03-06  36

Put it in the INI file! 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

Public Function FG_GetPrivateProfileString (_ ByRef StrSection As String, _ ByRef StrEntry As String _) As String Dim StrReturnedString As String * 255 Dim IntRet As Integer Dim StrFileName As String If Trim (StrSection) = "" Or Trim (StrEntry) = "" Then Exit Function End If strFileName = "/Stock.ini" intRet = GetPrivateProfileString (_ StrSection, StrEntry, _ "Default", _ StrReturnedString, 255, App.Path & strFileName) If intRet <> 0 Then FG_GetPrivateProfileString = Left (StrReturnedString, intRet ) End IF

END FUNCTION

Connection string lstrConnect = "driver = {microsoft oder = {microsoft odbc for oracle};" & _ "UID =" & fg_getPrivateProfileString ("Oracle", "UID") & ";" & _ "PWD =" & fg_getPrivateProfileString ("Oracle", "PWD") & ";" & _ "Server =" & fg_getprivateprofilestring ("Oracle", "Server") & "The content in the stock.ini file! [Oracle] UID = APWD = ASERVER = B

转载请注明原文地址:https://www.9cbs.com/read-62915.html

New Post(0)