We have been working to solve the issue early in the morning. This is a sample code to clearly show the situation. There are also more than 100 tables are waiting to get their records to calculate the results . Any idea ?
conn.h
#include "stdafx.h"
static double global ;
using namespace System;
using namespace System::Data::SQLite;
class conn
{
public:
static double energy_liver_calf; // global alternative here
//conn(){energy_liver_calf = 10 ;}
//~conn(){};
static double liver_calf_nutrition_facts()
{
// (+)
command->CommandText = "select energy_kcal from meatProducts where food_name = 'liver_calf' "; // sample query
SQLiteDataReader ^dataReader = command->ExecuteReader();
System::String^ kcal ;
if (dataReader->HasRows)
{
while (dataReader->Read())
{
kcal = dataReader["energy_kcal"]->ToString();
}
}
energy_liver_calf = System::Convert::ToDouble(kcal);
global = energy_liver_calf ;
return global ; // returns 135 ( RIGHT ! )
}
static double get_energy_liver_calf()
{
return global; // returns 0 ( WRONG !!!!!!!!!!!!!!!!!!!!!!!!!!!! )
}
};