private void PullLocationInformation()
{
try
{
//cb1_select_data.Items.Clear();
ArrayList stored_location = new ArrayList();
temp_building_values.Clear();//we need to clear the values for new items
//while loading it should populate the field...
//lets pull the vales offline values stored in db...
//string dir = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
//string connString = @"Data Source=GREENBIRD;Initial Catalog=db_psychrometric_project;Integrated Security=True";
//--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;";
// MessageBox.Show("connection string = " + connString);
using (SQLiteConnection connection = new SQLiteConnection(connString)) {
connection.Open();
SQLiteDataReader reader = null;
SQLiteCommand comm = new SQLiteCommand("SELECT * from tbl_building_location where selection = 1", connection);
//command.Parameters.AddWithValue("@1", userName)
reader = comm.ExecuteReader();
while (reader.Read())
{
temp_building_values.Add(new DataTypeTempBuildingValue
{
ID = int.Parse(reader["id"].ToString()),
country = reader["country"].ToString(),
state = reader["state"].ToString(),
city = reader["city"].ToString()
});
}
//--This is index_selected is later used for inserting lat , long value to db if not filled already
index_selected = temp_building_values[0].ID;
// MessageBox.Show("stored place = " + s);
comm.Dispose();
reader.Dispose();
connection.Close();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}