• DİKKAT

    DOSYA İndirmek/Yüklemek için ÜCRETLİ ALTIN ÜYELİK Gereklidir!
    Altın Üyelik Hakkında Bilgi

Ado Mysql Bağlantısı

  • Konbuyu başlatan Konbuyu başlatan hlojan
  • Başlangıç tarihi Başlangıç tarihi
Katılım
15 Mayıs 2015
Mesajlar
518
Excel Vers. ve Dili
Microsoft Office 2019
Arkadaşlar Ado ile Mysql bağlantısı yapıyorum

Bazen internet gidiyor. Bunu Excel vba ile nasıl kontrol ederim

İf internet yoksa then

Local DB

else

Mysql DB

end if

yardımlarınızı bekliyorum
 
Deneyin..
Kod:
[SIZE="2"]#If Win64 Then
    Private Declare PtrSafe Function [COLOR="Red"]InternetCheckConnection[/COLOR] _
    Lib "wininet.dll" Alias "InternetCheckConnectionA" _
    (ByVal lpszUrl As String, ByVal dwFlags As Long, ByVal dwReserved As Long) As Long
#Else
    Private Declare Function [COLOR="red"]InternetCheckConnection[/COLOR] _
    Lib "wininet.dll" Alias "InternetCheckConnectionA" _
    (ByVal lpszUrl As String, ByVal dwFlags As Long, ByVal dwReserved As Long) As Long
#End If

Sub Emre()
    Dim adres As String
    adres = "web adresini buraya yazın"
    If ([COLOR="red"]InternetCheckConnection[/COLOR](adres, &H1, 0&) = 0) Then
        Local DB
            Else
        Mysql Db
    End If
End Sub[/SIZE]
 
Bir başka alternatif;
Kod:
[SIZE="2"]Sub Emre()
Dim dizim(), ara, a As Integer, wmi As Object, oge As Object
Set wmi = GetObject("winmgmts:root\CIMV2").ExecQuery("SELECT * FROM Win32_NetworkAdapter", , 48)
    For Each oge In wmi
        If Not IsNull(oge.NetConnectionStatus) Then
            ReDim Preserve dizim(a)
            dizim(a) = oge.NetConnectionStatus
            a = a + 1
        End If
    Next oge
    If UBound(Filter(dizim, 2, True)) = 0 Then
        MsgBox "Bağlantı Var", vbInformation, "BİLGİ!"
            Else
        MsgBox "Bağlantı Yok", vbInformation, "BİLGİ!"
    End If
End Sub[/SIZE]
 
Son düzenleme:
Bir başka alternatif;
Kod:
[SIZE="2"]Sub Emre()
Dim dizim(), ara, a As Integer, wmi As Object, oge As Object
Set wmi = GetObject("winmgmts:root\CIMV2").ExecQuery("SELECT * FROM Win32_NetworkAdapter", , 48)
    For Each oge In wmi
        If Not IsNull(oge.NetConnectionStatus) Then
            ReDim Preserve dizim(a)
            dizim(a) = oge.NetConnectionStatus
            a = a + 1
        End If
    Next oge
    If UBound(Filter(dizim, 2, True)) = 0 Then
        MsgBox "Bağlantı Var", vbInformation, "BİLGİ!"
            Else
        MsgBox "Bağlantı Yok", vbInformation, "BİLGİ!"
    End If
End Sub[/SIZE]

Çok güzel. Teşekkürler
 
Rica ederim, iyi günler.
 
Geri
Üst