public bool checkForDataInSqlite()
{
string dir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string databasePath1 = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
string databaseFile1 = databasePath1 + @"\db_psychrometric_project.s3db";
string connString = @"Data Source=" + databaseFile1 + ";Version=3;";
//MessageBox.Show("Path = " + databaseFile1);
bool returnValue = false;
string id = "";
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("@index", index);
//command.Parameters.Add("@index",DbType.Int32).Value= index_selected;
//command.Parameters.AddWithValue("@index", index_selected);
reader = command.ExecuteReader();
while (reader.Read())
{
//ListboxItems.Add(reader[1].ToString()+","+reader[2].ToString());
id = reader["ID"].ToString();
}
}
if (id != "")
{
returnValue = true;
}
else
{
returnValue = false;
}
//--This will be either true or false based on the check value..
return returnValue;
}