private void get_stored_data_about_building()
{
try {
buildingList.Clear();
//--changing all the database to the sqlite database...
string databasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string databaseFile = databasePath + @"\db_psychrometric_project.s3db";
string connString = @"Data Source=" + databaseFile + ";Version=3;";
using (SQLiteConnection connection = new SQLiteConnection(connString))
{
connection.Open();
SQLiteDataReader reader = null;
string queryString = "SELECT * from tbl_building_location WHERE selection=1";
SQLiteCommand command = new SQLiteCommand(queryString, connection);
reader = command.ExecuteReader();
while (reader.Read())
{
buildingList.Add(new building_info_datatype
{
ID = int.Parse(reader["ID"].ToString()),
country = reader["country"].ToString(),
state = reader["state"].ToString(),
city = reader["city"].ToString(),
street = reader["street"].ToString(),
//ZIP = int.Parse(reader["ZIP"].ToString()),//--This zip code has be removed in latest version
latitude = reader["latitude"].ToString(),
longitude = reader["longitude"].ToString(),
elevation = int.Parse(reader["elevation"].ToString()),
buildingName = reader["BuildingName"].ToString(),
EngineeringUnits = reader["EngineeringUnits"].ToString()
});
}
}
} catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}