Centar za edukaciju-BiH



#11 06.07.2013 08:46
Gjoreski Van mreze
Administrator
Registrovan od:02.02.2009
Postovi:1,854


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):
  1. Public cn As ADODB.Connection
  2. Public Baza As String
  3. Public rs As ADODB.Recordset
  4. Public rsGrArtikli As ADODB.Recordset
  5. Public ID_Korisnik As Integer
  6. Sub Main()
  7. On Local Error GoTo Error_Main:
  8. Set cn = New ADODB.Connection
  9. '--------------------------  MySql Server so ini file ---------------------------------
  10. 'cn.ConnectionString = "Driver={Mysql ODBC 5.1 Driver}; Server=" & ReadIniValue(App.Path & "\Server.ini", "ServerSetup", "Server") & _
  11. '";port=3306; database=" & ReadIniValue(App.Path & "\Server.ini", "ServerSetup", "BazaDB") & _
  12. '"; user=" & ReadIniValue(App.Path & "\Server.ini", "ServerSetup", "User") & _
  13. '"; password=" & ReadIniValue(App.Path & "\Server.ini", "ServerSetup", "Password") & "; option=3;"
  14. '--------------------------  MsAccess Baza ---------------------------------------------
  15. cn.ConnectionString = "Driver={Microsoft Access Driver (*.mdb)};" & _
  16.                      "Dbq=DB_Sporedba.mdb;" & _
  17.                      "DefaultDir=" & App.Path & ";" & _
  18.                      "Uid=Admin;Pwd=;"
  19. '---------------------------------------------------------------------------------------
  20. Baza = App.Path & "\" & "DB_Sporedba.mdb"
  21. cn.Open
  22.  
  23. If cn.State = adStateOpen Then
  24.    frmLogin.Show
  25. End If
  26.  
  27. Main_Exit:
  28.    Exit Sub
  29.  
  30. Error_Main:
  31. 'MsgBox Err & "-->>>  " & Error(Err)
  32.  
  33. If Err = -2147467259 Then
  34.     Call MsgBox("PROBLEM SO POVRZUVAJNE SO BAZATA  ", vbOKOnly + vbCritical + vbApplicationModal + vbDefaultButton1, "VNIMANIE")
  35.      Resume Main_Exit:
  36. End If
↑  ↓

#12 06.07.2013 10:51
zxz Van mreze
Administrator
Registrovan od:03.02.2009
Postovi:10,642


Predmet:Re: Dlookup vo VB
Da sad stim ce da radi.
Mozes to staviti u koristan kod.
Podrska samo putem foruma, jer samo tako i ostali imaju koristi od toga.
↑  ↓

Stranice (2):1,2

Sva vremena su GMT +01:00. Trenutno vrijeme: 1: 32 am.