Advertisement
Magento15

Check Connection Database VB.NET

May 1st, 2017
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.82 KB | None | 0 0
  1. Imports System.Data.Odbc
  2. Imports MySql.Data.MySqlClient
  3.  
  4. Public Class Form3
  5.  
  6.     Const DSN = "DSN=namedsn"  'input the name dsn on odbc name , masukan nama data source name yang ada pada odbc
  7.     Dim connyogithesymbian As OdbcConnection
  8.  
  9.     Private Sub Button4_Click(sender As Object, e As EventArgs) Handles Button4.Click
  10.         Try
  11.             connyogithesymbian = New OdbcConnection(DSN)
  12.             connyogithesymbian.Open()
  13.             MsgBox("Server is ready" _
  14.                    & vbNewLine & "Lets login now", vbInformation, "INFORMATION")
  15.         Catch ex As Exception
  16.             MsgBox("Server is not ready" _
  17.                    & vbNewLine & "check internet connection", vbCritical, "ALERT SYSTEM")
  18. ' https://yogithesymbian.blogspot.com
  19. ' https://www.yogi-aw.id
  20.  
  21.         End Try
  22.     End Sub
  23.  
  24. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement