The code below keeps generating the following error and I don't know why???

testDatabaseModules.cs(28,6): error CS0246: The type or namespace name 'myConnection' could not be found (are you missing a using directive or an assembly reference?)

VB Code:
  1. using System;
  2. using System.Data;
  3. using System.Data.SqlClient;
  4. using System.Windows.Forms;
  5.  
  6. class Database
  7. {
  8.     public static void db_open(string ConnectionStringPayload)
  9.     {
  10.         if(ConnectionStringPayload == "")
  11.             MessageBox.Show("Connection Error.", "Invalid Connection String", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
  12.         else
  13.             try
  14.             {
  15.                 SqlConnection myConnection = new SqlConnection(ConnectionStringPayload);
  16.                 myConnection.Open();
  17.             }
  18.             catch
  19.             {
  20.                 MessageBox.Show("Connection Error", "Cannot connect to database, please check the connection string.");
  21.             }
  22.     }
  23.    
  24.     public static string db_state()
  25.     {
  26.         string state = "";
  27.         [color=red]if(myConnection.State.ToString() == "Open") ' errors here[/color]
  28.             state = "Open";
  29.         else
  30.             state = "Closed";
  31.            
  32.         return state;  
  33.            
  34.     }
  35.    
  36.     public static void Main()
  37.     {
  38.         string myConnectionString = ("server=localhost;database=pubs;user id=xxx;password=xxx;");
  39.         db_open(myConnectionString);
  40.         Console.WriteLine("Connection State: " + db_state());
  41.     }
  42. }