Suhail Kaleem » Page 2

extract date from datetime and then compare with date field

0

MSSQL 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

Equivalent of ID IN in LINQ

1

The IN query will get results within the given range

 

SQL

select * from tablename where id in(12,34,56)

Equivalent LINQ TO SQL (VB.NET)

From c In db.tablename Where (New Integer() {12,34,56}).Contains(c.id)

Equivalent LINQ TO SQL (C#)

from c in db.tablenamewhere (new int[] {
12,
34,
56
}).Contains(c.id)

How to fully trust a asp.net application (using command line and GUI )

0

Some 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

 

Go to Top