SQLiteDatabase.ClearTable C# (CSharp) 메소드

ClearTable() 공개 메소드

Allows the user to easily clear all data from a specific table.
public ClearTable ( String table ) : bool
table String The name of the table to clear.
리턴 bool
    public bool ClearTable(String table)
    {
        try
        {

            this.ExecuteNonQuery(String.Format("delete from {0};", table));
            return true;
        }
        catch
        {
            return false;
        }
    }

Usage Example

예제 #1
0
파일: Program.cs 프로젝트: Kaizen321/Logger
        static void Main()
        {
            //Needed for log4net to read from the app.config
            XmlConfigurator.Configure();

            var db = new SQLiteDatabase(@"D:\Fun\Code\GitHub\Logger\Database\MyLogs.db;");
            //Clearing previous test data
            db.ClearTable("Log");

            AddFakeData();
            RetrieveAndDisplayData(db);
        }