Set cn = New ADODB.Connection
If ReadIniValue(App.path & "\METMG.ini", "Baza", "TipBaza") = 1 Then
' My SQL server
cn.ConnectionString = "Driver={Mysql ODBC 5.1 Driver}; Server=" & ReadIniValue(App.path & "\METMG.ini", "ServerSetup", "Server") & _
";port=3306; database=" & ReadIniValue(App.path & "\METMG.ini", "ServerSetup", "BazaDB") & _
"; user=" & ReadIniValue(App.path & "\METMG.ini", "ServerSetup", "User") & _
"; password=" & ReadIniValue(App.path & "\METMG.ini", "ServerSetup", "Password") & "; option=3;"
DA = 1
NE = 0
'---------------------------------------------------------------------------------------
ElseIf ReadIniValue(App.path & "\METMG.ini", "Baza", "TipBaza") = 2 Then
'-------------------------- SHAPE SQL Server 2000 / 2005 so INI File -----------------------------
If ReadIniValue(App.path & "\METMG.ini", "ServerSetup", "Password") = "" Then Pass = ""
If ReadIniValue(App.path & "\METMG.ini", "ServerSetup", "Password") <> "" Then Pass = Enc.Decode64(ReadIniValue(App.path & "\METMG.ini", "ServerSetup", "Password"))
cn.ConnectionString = "PROVIDER=MSDataShape;Data PROVIDER=MSDASQL;Driver={SQL Server};Server=" & ReadIniValue(App.path & "\METMG.ini", "ServerSetup", "Server") & _
";Database=" & ReadIniValue(App.path & "\METMG.ini", "ServerSetup", "BazaDB") & _
";Uid=" & ReadIniValue(App.path & "\METMG.ini", "ServerSetup", "User") & _
";Pwd=" & Pass & ";"
DA = 1
NE = 0
'---------------------------------------------------------------------------------------
ElseIf ReadIniValue(App.path & "\METMG.ini", "Baza", "TipBaza") = 3 Then
'-------------------------- SHAPE MsAccess -------------------------------------------
Baza = ReadIniValue(App.path & "\METMG.ini", "ServerSetup", "PatekaBaza") & ReadIniValue(App.path & "\METMG.ini", "ServerSetup", "BazaDB") & ".mdb"
cn.ConnectionString = "PROVIDER=MSDataShape;Data PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & Baza & ";"
'---------------------------------------------------------------------------------------
DA = True
NE = False
End If
cn.Open
If cn.State = adStateOpen Then
Call Postavi_Parametri
'frmLogin.Show
'frmManu.Show
frmTest.Show
'' ActivateKeyboardLayout MKD, False
End If
Main_Exit:
Exit Sub
Error_Main:
If Err <> 0 And Err <> -2147217843 And Err <> -2147467259 Then MsgBox Err & " -->>> " & Error(Err)
If Err = -2147217843 Then
Call MsgBox("problem so povrzuvajne na serverot ", vbOKOnly + vbCritical + vbApplicationModal + vbDefaultButton1, "info")
frmParametri.Show
Resume Main_Exit:
End If
If Err = -2147467259 Then
Call MsgBox("bazata ne e povrzana ili ne posoi na serverot ", vbOKOnly + vbCritical + vbApplicationModal + vbDefaultButton1, "info")
frmParametri.Show
Resume Main_Exit:
End If