title: Bind a method to text box in wpf
body: <p>I am new to <code>wpf</code>. I have a method named ABC which returns max id from the database table. I want to bind this ABC to text box in <code>Xaml</code>.</p>
  
  <pre><code>public Int32 ABC()
  {
     OleDbConnection con = new OleDbConnection();
     con.ConnectionString = ConfigurationManager.ConnectionStrings["cn"].ConnectionString;
     if (con.State == ConnectionState.Closed)
     {
        con.Open();
     }
     OleDbCommand cmd = new OleDbCommand();
     cmd.CommandText = "select (max(uhid)) from patients"; 
     cmd.Connection = con;
     Int32 k = Convert.ToInt32(cmd.ExecuteScalar());
     return k + 1; // want to assign this value
  }
  </code></pre>