public void CheckSelectedBuilding()
{
selectedBuildingList.Clear();//Reset the values first ...
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);
// command.Parameters.AddWithValue("@selection_value", id);
//SqlDataAdapter dataAdapter = new SqlDataAdapter(queryString, connection.ConnectionString); //connection.ConnectionString is the connection string
reader = command.ExecuteReader();
while (reader.Read())
{
//Now lets add to the list
selectedBuildingList.Add(new SelectedBuildingDT
{
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 HAS BEEN REMOVED
longitude = double.Parse(reader["longitude"].ToString()),
latitude = double.Parse(reader["latitude"].ToString()),
elevation = double.Parse(reader["elevation"].ToString()),
BuildingName = reader["BuildingName"].ToString()
});
}
}//close of using..
}