Ngugi1 / sqlite-net

Automatically exported from code.google.com/p/sqlite-net
0 stars 0 forks source link

Results are not returned for fields, only properties #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
This works as expected : 

public class Ret
{
    public string Amount { get; set; }
}

var q = db.Query<Ret>("SELECT Amount FROM [Transaction]");

However, if I remove the get/set, in other words if Amount is a field and not 
an object property, then the result of Query will always return zero.

I spent a long time scratching my head wondering why no values were being 
returned, perhaps this bug report will help other devs.

Original issue reported on code.google.com by patrickjcollins@gmail.com on 30 Nov 2010 at 4:46

GoogleCodeExporter commented 9 years ago
Actually, it's worse than that:

public class MyClass {
    public string test;
}

If you create a table from that ( db.CreateTable<MyClass>() ), it throws an 
exception:

    near ")": syntax error

The query it tries to run is something like

    CREATE TABLE MyClass ()

which obviously is not right.

Original comment by caron.m...@gmail.com on 5 Dec 2010 at 5:21

GoogleCodeExporter commented 9 years ago
This is by design

Original comment by elite.da...@gmail.com on 19 Nov 2011 at 4:37