public long NumberOfEvents(string appID)
{
long count = 0;
string sqlCommand = string.Format(CultureInfo.InvariantCulture, "SELECT COUNT(*) C FROM {0} where {1} = @appID", TABLE_NAME, MA_APP_ID_COLUMN_NAME);
using (var connection = new SQLiteConnection("Data Source=" + this.DBfileFullPath + ";Version=3;"))
{
try
{
connection.Open();
using (var command = new SQLiteCommand(sqlCommand, connection))
{
command.Parameters.Add(new SQLiteParameter("@appID", appID));
using (var reader = command.ExecuteReader())
{
while (reader.Read())
{
count = (long)reader["C"];
}
}
}
}
finally
{
if (null != connection)
connection.Close();
}
}
return count;
}