31 Ocak 2010 Pazar

Birazda başka şeylerden bahsedelim!



Hep nefret ederdim o anason kokusundan... Tadı ve kokusu çok kötü gelirdi ta ki kuzenim dertli olduğum bir akşam denize karşı beni bir masaya oturtup bekle diyene kadar. Gitti içeriye ben hala masada boş boş hayatımda olan şeylere üzülüyorum... Önce mezeler geldi, meyve salatası, haydari, beyaz peynir, ezme vb... sonra rakı... Meğersem içmesini bilmiyormuşuz, bütün derdim tasam hepsi gitti. Evde biraz içilmiş eniştemlerin büyük rakısı vardı, hepsini bitirmişiz iki kişi :) O günden sonra ne anason kokusu rahatsız etti nede hayatımdaki dertler iyiki varsınız Dostlarım ve Rakım!

30 Eylül 2009 Çarşamba

MSSQL CREATE UNIQUE NONCLUSTERED INDEX

CREATE UNIQUE NONCLUSTERED INDEX [IX_INDEXNAME] ON TABLENAME
(
COLUMNNAME ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO

17 Ağustos 2009 Pazartesi

CASE (Transact-SQL)


Simple CASE expression:
CASE input_expression
WHEN when_expression THEN result_expression [ ...n ]
[ ELSE else_result_expression ]
END
Searched CASE expression:
CASE
WHEN Boolean_expression THEN result_expression [ ...n ]
[ ELSE else_result_expression ]
END



input_expression

Is the expression evaluated when the simple CASE format is used. input_expression is any valid expression.

WHEN when_expression

Is a simple expression to which input_expression is compared when the simple CASE format is used. when_expression is any valid expression. The data types of input_expression and eachwhen_expression must be the same or must be an implicit conversion.

THEN result_expression

Is the expression returned when input_expression equals when_expression evaluates to TRUE, or Boolean_expression evaluates to TRUE. result expression is any valid expression.

ELSE else_result_expression

Is the expression returned if no comparison operation evaluates to TRUE. If this argument is omitted and no comparison operation evaluates to TRUE, CASE returns NULL. else_result_expression is any valid expression. The data types of else_result_expression and any result_expression must be the same or must be an implicit conversion.

WHEN Boolean_expression

Is the Boolean expression evaluated when using the searched CASE format. Boolean_expression is any valid Boolean expression.



Select Name, StandardCost, ListPrice, (ListPrice - StandardCost)/StandardCost * 100,

case

when (ListPrice - StandardCost)/StandardCost * 100 <>

when (ListPrice - StandardCost)/StandardCost * 100 between 50 and 99 then 'Not Bad'

else 'Superb'

End [Profit]

from Product


SELECT ProductNumber, Name, 'Price Range' =

CASE

WHEN ListPrice = 0 THEN 'Mfg item - not for resale'

WHEN ListPrice <>

WHEN ListPrice >= 50 and ListPrice <>

WHEN ListPrice >= 250 and ListPrice <>

ELSE 'Over $1000'

END

FROM Production.Product

ORDER BY ProductNumber


Select AddressID, AddressLine1,

case

When AddressLine1 like '%Street%' or AddressLine1 like '%St.%' or

AddressLine1 like '%Ave%' or AddressLine1 like '%Rue%' then 1

else 0

End IsStreet

from Address

How can i change the font and font size in Visual Studio 2008


Menu->Tools->Options->Fonts and Colors

Then you can make whatever you want!


14 Ağustos 2009 Cuma

Best Way convert C# DateTime format to a SQL DateTime

private void Test(DateTime startdate)
{

SqlConnection cn = new SqlConnection("Data Source=myServerAddress;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;");

DateTime enddate = startdate.AddDays(1);

SqlDataAdapter da = new SqlDataAdapter
(
@"SELECT Top 10 id ID, firstname Firstname , lastname Lastname, email Email, gamescore GameScore
FROM GameScores
WHERE createDate >= '" + startdate.ToString("yyyy-MM-dd 00:00:00") + "' and createDate < '" + enddate.ToString("yyyy-MM-dd 00:00:00") +
@"' ORDER BY gamescore desc", cn
);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
}


//datetime.ToString("yyyy-MM-dd 00:00:00") is useful :)

11 Ağustos 2009 Salı

Veritabanı bağlantısı oluşturulamadı.

SQL Server veritabanını henüz oluşturmadıysanız, Web Sitesi Yönetim aracından çıkın, veritabanını oluşturmak ve yapılandırmak üzere aspnet_regsql komut satırı yardımcı programını kullanın, ardından sağlayıcıyı ayarlamak için bu araca dönün.


Hatasını aldığınızda Başlat->Programs->Microsoft Visual Studio 2008->Visual Studio Tools->Visual Studio 2008 Command Prompt seçeneğine tıklayın.

Çıkan ekrana aspnet_regsql komutunu yazıp enter' a basın. Bir wizard ekranı karşınıza gelecektir. Burdan daha önceden oluşturmuş olduğunuz bir database' le bağlantı kurmak için gerekli ayarları yapabilirsiniz.

10 Ağustos 2009 Pazartesi

Xml dosyalarının .NET Ortamında C# ile Okunup, Yazılması Örnek 2



Örnek 2:

using System;
using System.Xml;
namespace TypeReader
{
class TypeReader
{
static void Main(string[] args)
{
int ws = 0;
int pi = 0;
int dc = 0;
int cc = 0;
int ac = 0;
int et = 0;
int el = 0;
int xd = 0;
// Dosya bitene kadar dökümanı oku
XmlTextReader textReader = new XmlTextReader("C:\\books.xml");
while (textReader.Read())
{
XmlNodeType nType = textReader.NodeType;
// Node Tipi Declaration ise
if (nType == XmlNodeType.XmlDeclaration)
{
Console.WriteLine("Declaration:" + textReader.Name.ToString());
xd = xd + 1;
}
// Node Tipi Comment ise
if (nType == XmlNodeType.Comment)
{
Console.WriteLine("Comment:" + textReader.Name.ToString());
cc = cc + 1;
}
// Node Tipi Attribute ise
if (nType == XmlNodeType.Attribute)
{
Console.WriteLine("Attribute:" + textReader.Name.ToString());
ac = ac + 1;
}
// Node Tipi Element ise
if (nType == XmlNodeType.Element)
{
Console.WriteLine("Element:" + textReader.Name.ToString());
el = el + 1;
}
// Node Tipi Entity ise
if (nType == XmlNodeType.Entity)
{
Console.WriteLine("Entity:" + textReader.Name.ToString());
et = et + 1;
}
// Node Tipi Process Instruction ise
if (nType == XmlNodeType.ProcessingInstruction)
{
Console.WriteLine("Entity:" + textReader.Name.ToString());
pi = pi + 1;
}
// Node Tipi Document ise
if (nType == XmlNodeType.DocumentType)
{
Console.WriteLine("Document:" + textReader.Name.ToString());
dc = dc + 1;
}
// Node Tipi Boşluk ise
if (nType == XmlNodeType.Whitespace)
{
Console.WriteLine("WhiteSpace:" + textReader.Name.ToString());
ws = ws + 1;
}
}
// Sonucu yaz;
Console.WriteLine("Toplam Aciklama Satiri: " + cc.ToString());
Console.WriteLine("Toplam Öznitelik: " + ac.ToString());
Console.WriteLine("Toplam Eleman: " + el.ToString());
Console.WriteLine("Toplam Varlik: " + et.ToString());
Console.WriteLine("Toplam Islem Talimati: " + pi.ToString());
Console.WriteLine("Toplam Bildirim: " + xd.ToString());
Console.WriteLine("Toplam Döküman Tipi: " + dc.ToString());
Console.WriteLine("Toplam Bosluk: " + ws.ToString());
}
}
}