วันสุดท้ายของเดือน
Public Function GetLastDayOfMonth(ByVal CurrentDate As Date) As Date
Dim firstDay As New Date(CurrentDate.Year,
CurrentDate.Month, 1)
Dim result As Date =
firstDay.AddMonths(1).AddDays(-1)
Return result
End Function
|
บังคับใช้ ค.ศ. ในโปรแกรม
Sub New()
Threading.Thread.CurrentThread.CurrentCulture = New Globalization.CultureInfo("en-US")
End Sub
|
LINQ to SQL Timeout
dbc.CommandTimeout = 30 ' Default 30 Second
dbc.CommandTimeout = 60 ' Custom 60 Seconddbc.CommandTimeout = 0 ' Not Time Out
|
Empty List of Anonymous
Private Function CreateEmptyList(Of T)(ByVal unused As T) As List(Of T)
Return New List(Of T)()
End Function
Dim lstItemCredit = Me.CreateEmptyList(New With {.Item_ID = String.Empty, .Item_Name = String.Empty})
lstItemCredit.Add(New With {.Item_ID = "", .Item_Name = ""})
lstItemCredit.AddRange((From t0 In dbc.Item_Credits
Select New With {.Item_ID = t0.Item_ID.ToString, t0.Item_Name}).ToList)
|