[INCLUDE]
MySQL_Shared

[CODE]
Public Function MySQL_Reconnect(ByVal Host As String, ByVal User As String, ByVal Password As String, Optional ByVal Database As String, Optional ByVal Port As Long) As Boolean
  Dim xLong1 As Long

  xLong1 = mysql_initreal(0&)
  If Not xLong1 = 0& Then
    If Port = 0& Then Port = 3306&
    If mysql_real_connect(xLong1, Host, User, Password, Database, Port, "NULL", 2&) = 0& Then
      Call mysql_closereal(xLong1)
      Else
      Call mysql_queryreal(xLong1, "SET @@AUTOCOMMIT = 1")
      If Not MySQL_Handle = 0& Then
        Call mysql_closereal(MySQL_Handle)
        End If
      MySQL_Handle = xLong1
      MySQL_Reconnect = True
      End If
    End If
  End Function
