Sql select query is only returning last row n times
I'm using webmatrix. My home server is Ubuntu/mono/nginx/fastcgi. My code
is simple. I have a MySql database with a table that contains 4 test
records.
@{
var db = Database.Open("wra");
var sql = "SELECT * FROM Clients";
var clientinfo = db.Query(sql);
WebGrid grid = new WebGrid(clientinfo);
}
<div>
@grid.GetHtml()
</div>
That's it - doesn't get simpler. However, the grid returns only the last
record and displays it 4 times (= number of records). I have tested this
with other databases and tables with same result. There is no error, so no
stack trace. The problem doesn't appear to be webgrid as it only displays
the results. Just to be sure, I removed webgrid and just created a table -
same result. The problem doesn't appear to be the database as I've tested
with other dbs with same result. I also ran the query on the server (using
putty) with no probem, so the query should work. I have searched
extensively for an answer. I would appreciate any assistance offered.
Thanks in advance.
No comments:
Post a Comment