admin
(1 comments, 3 posts)
This user hasn't shared any profile information
Posts by admin
Get months list between two dates
0Following function will get a list of months with days remaining in those months when start date and end dates are provided
Shared Function GetMonthsList(StartDate As Date, EndDate As Date) As ArrayList
Try
Dim dt As Date = StartDate
Dim edt As Date = EndDate
Dim ar As New ArrayList
Dim str As New StringBuilder
While dt < edt
str.Append(dt.Date.ToString("MMMM yyyy"))
str.Append(",")
Dim dt2 As Date = dt.AddMonths(1)
If dt2 > edt Then
Dim minusdays As Integer = DateDiff(DateInterval.Day, dt, edt)
str.Append(minusdays + 1)
ar.Add(str.ToString)
Exit While
End If
Dim remainingdays As Integer = System.DateTime.DaysInMonth(dt.Year, dt.Month) - dt.Day
str.Append(remainingdays + 1)
ar.Add(str.ToString)
dt = dt.AddDays(remainingdays + 1)
str.Clear()
End While
Return ar
Catch ex As Exception
Throw ex
End Try
End Function
Use can use this functions as
GetMonthsList(Date.Parse("1/4/2012"),Date.Parse("4/30/2012"))
this will output
January 2012,28
February 2012,29
March 2012,31
April 2012,30
extract date from datetime and then compare with date field
0MSSQL 2005 does not have DATE datatype only datetime and smalldatetime
datetime will return date and time
where as ms sql 2008 have DATE datatype which makes it easy to extract date
mysql also have DATE datatype
for mssql 2005
following is the code to extract just the date part from datetime field
i will be using getdate function to get current date time you can replace getdate() with datetime field name
Cast(Floor(Cast(GetDate() As Float)) As DateTime)
this will extract date from datetime field
and this how you compare
select * from YourTable where
Cast(Floor(Cast(GetDate() As Float)) As DateTime) > YourDateTImeField
How to fully trust a asp.net application (using command line and GUI )
0Some server do not have “Microsoft .NET Framework 2.0 Configuration” in there administrative Tools
they can use CasPol.exe to Fully Trust a website.
Please run the following code in command line.
%windir%\Microsoft.NET\Framework\v2.0.50727\caspol -quiet -m -ag All_Code -url “http://localhost/*” FullTrust
you can also download .NET Framework 2.0 Software Development Kit (SDK) to install Microsoft .NET Framework 2.0 Configuration
and you can trust a website using the GUI like below
1. From the Start menu, point to Administrative Tools, and then click Microsoft .NET Framework 2.0 Configuration.
If you don’t have Administrative Tools on the Start menu, from the Control Panel open Administrative Tools, and then double-click Microsoft .NETFramework 2.0 Configuration.
2. Under My Computer, expand the Runtime Security Policy node, the Machine node, Code Groups node, the All_Code node, and then right-click the All_Code node and click New to open the Create Code Group dialog box.
3. Name the new code group 'MY WEB APPLICATION NAME', and then click Next.
4. Select a ‘Site’ membership condition from the drop down box
5. Under ‘Site name’ type in the URL to my web application
6. Give ‘FullTrust’ permission set and click Finish
7. To apply the new settings, close and restart your browser
Recent Comments