public int CountingDB_Item(string db_name)
{
string stmt = "SELECT COUNT(*) FROM "+db_name+"";
string databasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string databaseFile = databasePath + @"\db_psychrometric_project.s3db";
string connString = @"Data Source=" + databaseFile + ";Version=3;";
using (SQLiteConnection thisConnection = new SQLiteConnection(connString))
{
using (SQLiteCommand cmdCount = new SQLiteCommand(stmt, thisConnection))
{
SQLiteDataReader reader = null;
thisConnection.Open();
// countDB_Item = (int)cmdCount.ExecuteScalar();
reader = cmdCount.ExecuteReader();
while (reader.Read())
{
countDB_Item = int.Parse(reader[0].ToString());
// currentLineTableFromDB = reader["line_table"].ToString();
}
}
}
return countDB_Item;
}