-1

Here is a table Lunchmenu

    [MenuID] [int] IDENTITY(1,1) PRIMARY KEY NOT NULL,
    [MenuDate] [datetime] NULL,
    [MenuItem] [nvarchar](100) NULL,
    [ClientId] [int] FOREIGN KEY NULL,

How to select all menu items within a date range for a given client id USING SQL and LINQ

4

1 に答える 1

1

Sql では次のようになります。

Select * from LunchMenu where MenuDate between '01/12/13' and '02/12/13' and ClientId = @clientid

linq は、vClientId が渡される値などのようなものになります....:

var result = from r in context.LunchMenu
where r.Menudate >= "01/02/13" && r.MenuDate <= "02/12/13" && r.ClientID = vClientId
select r;
于 2013-02-13T18:54:42.560 に答える