Created
September 3, 2012 14:10
-
-
Save hudo/3609590 to your computer and use it in GitHub Desktop.
webmatrix db primjer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@{ | |
// sve unutar ovog bloka je c#, a ostalo je HTML | |
var db = Database.Open("ImeBaze"); | |
var news = db.Query("SELECT * FROM NewsItems ORDER BY NewsDate DESC"); | |
db.Execute("INSERT INTO NewsItems (Title) VALUES (@0)", "Naslov"); | |
} | |
<html> | |
<body> | |
<table> | |
@foreach(var newsItem in news) | |
{ | |
<tr><td>@newsItem.Title</td></tr> | |
} | |
</table> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment