开发者

How to insert empty record in linq DataSource?

开发者 https://www.devze.com 2023-01-18 04:53 出处:网络
I have a table \"Information\" in my dataBase(SQL), it has 3 fields : ID , Date , Description I want to show this data in a gridview between date1 and date2, but I want to show an empty record for dat

I have a table "Information" in my dataBase(SQL), it has 3 fields : ID , Date , Description

I want to show this data in a gridview between date1 and date2, but I want to show an empty record for date3 if date3 is between date1 and date2 but there is no data in my table that Dat开发者_JS百科e = date3, how can i do this with C# and Linq?


Here's an example in VB

Dim varListado As List(Of Information) = (From varNNN In varEntidades.Information Where varNNN.ID > 0 Select varNNN).ToList

If addNew = True Then
    Dim varNew As New Information
    varNew.ID = 0
    varNew.Description = "New Record Added"
    varNew.Date = Now
    varListado.Insert(0, varNew)
End If
0

精彩评论

暂无评论...
验证码 换一张
取 消