24 Mayıs 2010 Pazartesi

Select random rows from a MS-SQL Server table

SELECT TOP 1 *
FROM TABLE_NAME
ORDER BY NEWID()

11 Mayıs 2010 Salı

The process cannot access the file because it is being used by another process

If you are getting this error while you want to delete attachment of a mail you must dispose that mail.

mail.Dispose();

will works fine!

10 Mayıs 2010 Pazartesi

Make someone follow you on Twitter


It simple twitter has a bug
go to http://twitter.com/ and login



then tweet "accept [username]" [username] that you typed will follow you! :)))

#Fail

http://hasanbasusta.com/sosyal-medya/dalai-lamanin-takip-ettigi-tek-insan-korhan-kurt.html

9 Mayıs 2010 Pazar

Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same

if you have;

"Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that configuration specifies the same validationKey and validation algorithm. AutoGenerate cannot be used in a cluster."
Error Add ;

pages enableViewStateMac="false" in system.web in web.config

3 Mayıs 2010 Pazartesi

How to delete a folder which has files? in C#

Directory.Delete(directoryname, true)

24 Nisan 2010 Cumartesi

The ' ' character, hexadecimal value 0x20, cannot be included in a name.

An XmlElement is something that look a bit like "" in
XML. If it has a space, then it won't be an element any more, because
that would make it look like "", and the 'thing' would look
like the start of an attribute.

So, either you need to rule out spaces, or you need to devise some
escaping mechanism to substitute the spaces with some other characters.

Select Only Year of Datetime MSSQL

SELECT DISTINCT CONVERT(CHAR(4), @DatetimeValue, 120) as Year
FROM Events