Problem with Save()

Aug 18, 2011 at 3: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!

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 11:04 AM

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.