title: How to drop table in Xamarin from sqlite database
body: <p>I am unable to drop tables completely from sqLite database in XAMARIN using command <code>db.DropTable&lt;tablename&gt;</code>. It gets dropped at first but appears again every time I restart the application. Also I have multiple tables with the same name and I need to drop them all. What should I do?</p>
  
  <p>I am developing an android application in Visual Studio using XAMARIN and C#.</p>
  
  <p>Unfortunately I created many tables with the same name. Now I need to drop them.</p>
  
  <p>I am using following code to create tables and database:-</p>
  
  <pre><code>namespace Test
  {
  [Table("OrderDetails")]
  public class OrderDetails
  {
      [PrimaryKey, AutoIncrement, Column("_id")]
      public int Id { get; set; }
      [MaxLength(50)]
      public string payeename { get; set; }
      [MaxLength(100)]
      public string commodity { get; set; }
  
      public int give { get; set; }
  
      public int take { get; set; }
      public DateTime date { get; set; }
  }
  
  [Activity(Label = "Test", MainLauncher = true)]
  public class MainActivity : Activity
  {
  
      [Table("Items")]
      public class PayeeMaster
      {
          [PrimaryKey, AutoIncrement, Column("_id")]
          public int Id { get; set; }
          [MaxLength(8)]
          public string FirstName { get; set; }
          [MaxLength(8)]
          public string LastName { get; set; }
      }
      SQLiteConnection db;
  
      protected override void OnCreate(Bundle savedInstanceState)
      {
          base.OnCreate(savedInstanceState);
  
          // Set our view from the "main" layout resource
          SetContentView(Resource.Layout.Main);
  
          CreateDatabase();
  
  
  
      }
  
  
     public bool ifExists_Table(string tablename)
      {
  
  
  
          SQLiteCommand command = db.CreateCommand("SELECT COUNT(1) FROM SQLITE_MASTER WHERE TYPE = @TYPE AND NAME = @NAME");
          command.Bind("@TYPE", "table");
          command.Bind("@NAME", tablename);
  
          int result = command.ExecuteQuery&lt;int&gt;();
          return (result &gt; 0);
  
  
      }
  
    public void CreateDatabase() {
       try
       {  
              string dbPath = Path.Combine(
  
  System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal),
              "Master.db3");
  
              db = new SQLiteConnection(dbPath);
  
          }
          catch (IOException ex)
          {
              var reason = string.Format("The database failed to create - 
       reason {0}", ex.Message);
  
          }
  
  
  
              if (!ifExists_Table("PayeeMaster"))
              {
  
                  db.CreateTable&lt;PayeeMaster&gt;();
              }
  
              else
              {
                  var count = db.Table&lt;PayeeMaster&gt;().Count();
  
              }
  
  
  
          if (!ifExists_Table("OrderDetails"))
              {
  
                  db.CreateTable&lt;OrderDetails&gt;();
              }
  
              else {
                  var count = db.Table&lt;OrderDetails&gt;().Count();
              }
  
  
       }
   }
  </code></pre>