?? mdlset_init.bas
字號(hào):
Attribute VB_Name = "MdlSet_Init"
Public Gcon_main As New ADODB.Connection
Public Session As New Domino.NotesSession
Public ConfigTable As String
Public gsDataBase As String
Public Str_Connection As String
Public GStr_Connection As String
Public Const ini = "oa.ini"
Public WinDir As String
Public confwRs As New ADODB.Recordset
Public txtCount As String
Public txtwsdaDominoServer As String
Public txtwsdaDominoDatabase As String
Public txtwsdaview As String
Public txtwsdaZD As String
Public txtwsdaTable As String
Public txtwsdaAdvice As String
Public txtwsdaAdviceZD As String
Public txtwsdaYW As String
Public txtwsdaYWPath As String
Public txtwsdaYWHttpPath As String
Dim txtpass As String
Public strfwgzzd As String
Public strswgzzd As String
Public strbmfwgzzd As String
Public strxxgzzd As String
Public strqbgzzd As String
Public conswRs As New ADODB.Recordset
Public Declare Function GetWindowsDirectory Lib "kernel32" Alias "GetWindowsDirectoryA" (ByVal lpBuffer As String, ByVal nSize As Long) As Long
Public 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
Sub Main()
On Error GoTo err_main
'''''''''''''''''連接oracle
WinDir = P_GetWinDir()
WinDir = App.path & "\"
''''''''' gsDataBase = "ORACLE Driver"
''''''''' If gsDataBase = "SQLSERVER" Then
''''''''' Str_Connection = "DRIVER=SQL Server;SERVER=" & _
''''''''' GetSetting("PDE", "DATASET", "SERVER") & _
''''''''' ";DATABASE=" & GetSetting("PDE", "DATASET", "DATASOURCE") & _
''''''''' ";User Id= " & GetSetting("PDE", "DATASET", "USERID") & _
''''''''' ";password=" & GetSetting("PDE", "DATASET", "PASSWORD") & ";Timeout=300;"
''''''''' ElseIf gsDataBase = "ORACLE Driver" Then
''''''''' Str_Connection = "Provider=OraOLEDB.Oracle.1;User ID=" & _
''''''''' GetSetting("PDE", "DATASET", "USERID") & _
''''''''' ";password=" & GetSetting("PDE", "DATASET", "PASSWORD") & _
''''''''' ";Data Source=" & GetSetting("PDE", "DATASET", "DATASOURCE") & _
''''''''' ";Persist Security Info=False;"
''''''''' 'Str_Connection = "DATASOURCE=Provider=MSDAORA.1;User ID=" & _
'''''''''
''''''''' ElseIf gsDataBase = "ORACLE Driver1" Then
''''''''' 'Str_Connection = "Provider=OraOLEDB.Oracle.1;User ID=dyp;password=123;Data Source=dyp;Persist Security Info=False;" '需要修改
''''''''' Str_Connection = "Provider=MSDAORA.1;User ID=" & _
''''''''' GetSetting("PDE", "DATASET", "USERID") & _
''''''''' ";password=" & GetSetting("PDE", "DATASET", "PASSWORD") & _
''''''''' ";Data Source=" & GetSetting("PDE", "DATASET", "DATASOURCE") & _
''''''''' ";Persist Security Info=true;"
''''''''' 'Str_Connection = P_GetProFile("SYSTEM", "DataSource", ini)
'''''''''
''''''''' Else
''''''''' GoTo err_main
''''''''' End If
''''''''' MsgBox Str_Connection
''''''''' 'Oraoledb.oracle.1 MSDAORA.1
''''''''' With Gcon_main
''''''''' .CursorLocation = adUseClient
''''''''' If gsDataBase = "SQLSERVER" Then
''''''''' .Provider = "MSDASQL"
''''''''' End If
''''''''' If gsDataBase = "ORACLE" Then
''''''''' '.Provider = "MSDAORA.1"
''''''''' .Provider = "OraOLEDB.Oracle.1"
''''''''' End If
''''''''' If gsDataBase = "ORACLE Driver" Then
''''''''' .Provider = "OraOLEDB.Oracle.1"
''''''''' End If
'''''''''
''''''''' .CursorLocation = adUseClient
''''''''' .ConnectionString = Str_Connection
''''''''' .Open
''''''''' End With
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'Str_Connection = "Provider = OraOLEDB.Oracle.1;UserID=archive_fz;password=123456;DataSource=portal_134.224.52.105;Persist Security Info=True;"
'Gcon_main.CursorLocation = adUseClient
'Gcon_main.Provider = "OraOLEDB.Oracle.1"
'Gcon_main.CursorLocation = adUseClient
'Gcon_main.ConnectionString = Str_Connection
Str_Connection = "Provider=MSDAORA.1;User ID=" & _
GetSetting("PDE", "DATASET", "USERID") & _
";password=" & GetSetting("PDE", "DATASET", "PASSWORD") & _
";Data Source=" & GetSetting("PDE", "DATASET", "DATASOURCE") & _
";Persist Security Info=false;"
Gcon_main.Provider = "MSDAORA.1"
Gcon_main.ConnectionString = Str_Connection
MsgBox Str_Connection
Gcon_main.Open
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim struid As String
Dim struiddes As String
struid = GetSetting("PDE", "DATASET", "USERID")
If struid = "archive_gz" Then struiddes = "贛州市分公司"
If struid = "archive_nc" Then struiddes = "南昌市分公司"
If struid = "archive_sr" Then struiddes = "上饒市分公司"
If struid = "archive_jj" Then struiddes = "九江市分公司"
If struid = "archive_fz" Then struiddes = "撫州市分公司"
If struid = "archive_yc" Then struiddes = "宜春市分公司"
If struid = "archive_ja" Then struiddes = "吉安市分公司"
If struid = "archive_jdz" Then struiddes = "景德鎮(zhèn)市分公司"
If struid = "archive_px" Then struiddes = "萍鄉(xiāng)市分公司"
If struid = "archive_xy" Then struiddes = "新余市分公司"
If struid = "archive_yt" Then struiddes = "鷹潭市分公司"
If struid = "archive_ywclzx" Then struiddes = "業(yè)務(wù)處理中心"
If struid = "archive_wgzx" Then struiddes = "網(wǎng)絡(luò)管理中心"
If struid = "archive_csj" Then struiddes = "電信傳輸局"
If struid = "archive" Then struiddes = "江西省電信有限公司"
If struid = "archive_zczx" Then struiddes = "技術(shù)支撐中心"
If MsgBox("已經(jīng)連接到 --[" & struiddes & "]," & Chr(13) & "你想繼續(xù)[" & struiddes & "]OA 文書(shū)檔案數(shù)據(jù)操作嗎?" & Chr(13), vbQuestion + vbOKCancel, "信息") = vbCancel Then Exit Sub
'''''''''''''''''''''''''''
'''連接到Domino數(shù)據(jù)庫(kù)
Set Session = CreateObject("Lotus.NotesSession")
txtpass = P_GetProFile("SYSTEM", "DominoPass", ini)
Call Session.Initialize(txtpass) '需要修改
'''''''''''''取出配置文檔中省公司文檔管理的信息
txtwsdaDominoServer = P_GetProFile("SYSTEM", "DominoServer", ini)
txtwsdaDominoDatabase = P_GetProFile("SYSTEM", "DominowsdaDataBase", ini)
txtwsdaview = P_GetProFile("SYSTEM", "wsdaView", ini)
txtwsdaZD = P_GetProFile("SYSTEM", "wsdazd1", ini) + "," + P_GetProFile("SYSTEM", "wsdazd2", ini)
txtwsdaTable = P_GetProFile("SYSTEM", "MainTable", ini)
txtwsdaYW = P_GetProFile("SYSTEM", "YWTable", ini)
txtwsdaYWPath = P_GetProFile("SYSTEM", "YWPath", ini)
txtwsdaYWHttpPath = P_GetProFile("SYSTEM", "XNPath", ini)
'''''''''''''''''''''
txtCount = P_GetProFile("SYSTEM", "count", ini)
''''''''''''意見(jiàn)字段列表
strfwgzzd = P_GetProFile("SYSTEM", "fwgzzd", ini)
strswgzzd = P_GetProFile("SYSTEM", "swgzzd", ini)
strbmfwgzzd = P_GetProFile("SYSTEM", "bmfwgzzd", ini)
strxxgzzd = P_GetProFile("SYSTEM", "xxgzzd", ini)
strqbgzzd = P_GetProFile("SYSTEM", "qbgzzd", ini)
'''''''''''''''''''''''''''''''
firform.Show
Exit Sub
err_main:
MsgBox "發(fā)生異常,請(qǐng)檢查oa.ini 文件設(shè)置!" & Err.Description
Exit Sub
End Sub
Public Function P_GetWinDir() As String
Dim X As String * 50, v As Long
Dim CompName As String
Dim i As Integer
v = GetWindowsDirectory(X, Len(X))
i = InStr(1, X, Chr(0))
CompName = Left(X, i - 1)
P_GetWinDir = CompName
End Function
Public Function P_GetProFile(contents As String, texthead As String, Filename As String) As String
Dim str1 As String * 255
Dim u As Long
u = GetPrivateProfileString(contents, texthead, "", str1, Len(str1), Trim(WinDir) & Filename)
If u = 0 Then
Beep
Else
P_GetProFile = Left(str1, InStrRev(str1, ";") - 1)
End If
End Function
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -