I suppose that db is an object of Database type from the WebMatrix.Data namespace, opened with a command like
var db = Database.Open("yourDb");
If this is right, the Execute method (with the capital E) doesn't return a query, but an integer that is the count of records affected by the SQL statement executed (INSERT, UPDATE or DELETE).
The methods that return the result of a query are three: Query, QuerySingle and QueryValue.
Query returns a list of rows as IEnumerable of Objects. The following example queries a Northwind table and displays the result:
@{
var db = Database.Open("Northwind");
var data = db.Query("SELECT ProductID, ProductName FROM Products WHERE SupplierID = 1");
foreach (var row in data){
<p>@row.ProductID - @row.ProductName</p>
}
}
QuerySingle returns a single row as Object, e.g.:
@{
var db = Database.Open("Northwind");
var data = db.QuerySingle("SELECT ProductID, ProductName FROM Products WHERE ProductID = 10");
<p>@data.ProductID - @data.ProductName</p>
}
QueryValue returns a single value as Object:
@{
var db = Database.Open("Northwind");
var data = db.QueryValue("SELECT UnitPrice FROM Products WHERE ProductID = 14");
<p>The price of product n. 14 is: @data</p>
}