Problem with Save()

Aug 18, 2011 at 4:22 PM

First, Thank you for this great database :)) I have some problems with Save() method... I have following code :

 

private Database data;

public Converter()
{
data = Database.OpenDatabase(DATABASE_NAME);
 }

public void ConvertToEuFromUs()
{
foreach (var d in data.Table<Model.Fuel>())
{
d.Distance = DistanceConverter.MileToKilometer(d.Distance);
d.OdometerDistance = DistanceConverter.MileToKilometer(d.OdometerDistance);
d.Quantity = QuantityConverter.GallonToLiter(d.Quantity);
d.Metrics = Enum.FuelMetrics.EuropanMetrics;

d.Average = Math.Round((d.Quantity * 100) / d.Distance, 2);
//change recalculate!
data.Save();
}
}

But for some weird reason Save() is not working. Converting is done OK, but data.Save() is not saving anything... It's weird, because that method is working in other places, but in this Class not. Can you tell me where to look for error or something like that. Thank you in advance..

 

Aug 19, 2011 at 12:04 PM

I would put the Save() call outside foreach loop.  It will be more efficient at the very least.  If this does not solve the issue, email me a sample app, and I will take a closer look. 

THanks.