|
| chenyaping034 : On March 14, 2008 10:02 AM said: |
I like the video!I wish more and more the good video about the konwledge of LINQ
|
|
|
| Lee Dumond : On April 08, 2008 1:35 PM said: |
Just would like to point out a couple of errors in the code:
In part9.aspx, line 31:
Product p = db.Products.Single(p => p.ProductName == "Foo");
You can't declare a local variable "p" in the lambda expression here, because "p" is already used to denote the Product. You could change it to something else, like:
Product p = db.Products.Single(prod => prod.ProductName == "Foo");
In Helpers.cs, line 57:
return ExecuteCommand("delete from products where ProductId={0}", instance.ProductID);
DeleteProduct is a void method, so it can't return anything. You need to get rid of the "return" keyword.
|
|
|
| LoftenPierce : On April 21, 2008 3:17 PM said: |
I have a question: I want to be able to leverage my code to use LinQ to sql. We have a DAL generator that creates our sprocs from out tables. As such, we include the CRUD sql code in the sproc, using an "Action" parameter, which tells which sql code to run (0=read, 1=create, 2=update, and 3=delete). I've been trying to get linq to work with this model. How do I get linq to use the parms that I want and ignore the rest? Here's how I get it to work now:
Dim db As New MOCDataContext
Dim q = db.SProc_MOCT_CC(0, Nothing, Nothing, Nothing, Nothing, Nothing)
GridView1.DataSource = q
GridView1.DataBind()
The first parm is the action, the rest I set to use 'Nothing' to ignore the other parms. Normally, I would just pass the parms I wanted the 2nd or third parms I would fill in (via class properties) and leave the others. How can I get around this? Am I making sense?
|
|
Leave a Comment
You must be logged in to leave a comment. Click here to log in.