title: How to display database connection status in VB 2010
body: <p>I'm developing Point of sales system. and i want to display database connection status for the users. Im using MS Access 2013 database and Visual Studio 2010 (VB). I created module for this project as follows,</p>
  
  <pre><code>Imports System.Data.OleDb
  Module ModConVar
      Public sql As String
      Public cmd As OleDbCommand
      Public dr As OleDbDataReader
  
      Public conn As OleDbConnection
      Public connStr As String = System.Environment.CurrentDirectory.ToString &amp; "\NCS_POS_DB.accdb"
  
      Public Sub ConnDB()
          Try
              conn = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" &amp; connStr &amp; "")
              conn.Open()
          Catch ex As Exception
              MsgBox(ex.Message)
          End Try
      End Sub
  End Module
  </code></pre>
  
  <p>And I have a label named lblDBStatus in main MDI form, I tried with followin code, but it dosent work.</p>
  
  <pre><code>If conn.State = ConnectionState.Open Then
      lblDBStatus.Text = "CONECTED"
  End If
  </code></pre>
  
  <p>any suggestions please ?? </p>