|
ASP源代码: @{
var db = Database.Open("SmallBakery");
var query = "SELECT * FROM Product";
}
<html>
<body>
<h1>Small Bakery Products</h1>
<table border="1" width="100%">
<tr>
<th>Id</th>
<th>Product</th>
<th>Description</th>
<th>Price</th>
</tr>
@foreach(var row in db.Query(query))
{
<tr>
<td>@row.Id</td>
<td>@row.Name</td>
<td>@row.Description</td>
<td align="right">@row.Price</td>
</tr>
}
</table>
</body>
</html> 运行结果: Small Bakery Products| Id | Product | Description | Price | | 1 | Bread | Baked fresh every day | 2.99 | | 2 | Strawberry Cake | Made with organic strawberries | 9.99 | | 3 | Apple Pie | Second only to your mom's pie | 12.99 | | 4 | Pecan Pie | If you like pecans, this is for you | 10.99 | | 5 | Lemon Pie | Made with the best lemons in the world | 11.99 | | 6 | Cupcakes | Your kids will love these | 9.99 |
|