Predmet:Re: Dlookup vo VB
Jas konekcija cn ja imam staveno na pocetok koga se pokreva i samiot program odnosno vo sub Main
PreuzmiIzvorni kôd (Visual Basic):Public cn As ADODB.Connection
Public Baza As String
Public rs As ADODB.Recordset
Public rsGrArtikli As ADODB.Recordset
Public ID_Korisnik As Integer
Sub Main()
On Local Error GoTo Error_Main:
Set cn = New ADODB.Connection
'-------------------------- MySql Server so ini file ---------------------------------
'cn.ConnectionString = "Driver={Mysql ODBC 5.1 Driver}; Server=" & ReadIniValue(App.Path & "\Server.ini", "ServerSetup", "Server") & _
'";port=3306; database=" & ReadIniValue(App.Path & "\Server.ini", "ServerSetup", "BazaDB") & _
'"; user=" & ReadIniValue(App.Path & "\Server.ini", "ServerSetup", "User") & _
'"; password=" & ReadIniValue(App.Path & "\Server.ini", "ServerSetup", "Password") & "; option=3;"
'-------------------------- MsAccess Baza ---------------------------------------------
cn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};" & _
"Dbq=DB_Sporedba.mdb;" & _
"DefaultDir=" & App.Path & ";" & _
"Uid=Admin;Pwd=;"
'---------------------------------------------------------------------------------------
Baza = App.Path & "\" & "DB_Sporedba.mdb"
cn.Open
If cn.State = adStateOpen Then
frmLogin.Show
End If
Main_Exit:
Exit Sub
Error_Main:
'MsgBox Err & "-->>> " & Error(Err)
If Err = -2147467259 Then
Call MsgBox("PROBLEM SO POVRZUVAJNE SO BAZATA ", vbOKOnly + vbCritical + vbApplicationModal + vbDefaultButton1, "VNIMANIE")
Resume Main_Exit:
End If