Created
November 17, 2012 15:47
-
-
Save okaram/4096944 to your computer and use it in GitHub Desktop.
LinQ basics
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
protected void AddBlog_Click(object sender, EventArgs e) | |
{ | |
SimpleBlogDataContext ctx = new SimpleBlogDataContext(); | |
Blog b = new Blog(); | |
b.Title = BlogTitle.Text; | |
ctx.Blogs.InsertOnSubmit(b); | |
try | |
{ | |
ctx.SubmitChanges(); | |
} | |
catch (Exception e1) | |
{ | |
Console.WriteLine(e1); | |
} | |
} |
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
<%@ Import namespace="System.Linq" %> |
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
SimpleBlog.SimpleBlogDataContext ctx = new SimpleBlog.SimpleBlogDataContext(); | |
var blogs = from b in ctx.Blogs | |
select b; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment