Emad's Blog

Thoughts/Tips/Shortcuts/Ideas from a .NET software engineer

Archive for July, 2007

Nice "How do I?" Videos from microsoft

Posted by emadmagdy on July 16, 2007

A nice collection of short “how do I?” videos from microsoft covering a wide variety of technologies: ASP.NET, SQL EXPRESS, AJAX, VS Team syste, etc.

http://msdn2.microsoft.com/en-us/asp.net/bb498194.aspx

Posted in Uncategorized | Leave a Comment »

Add Identity Column to Table created by SELECT INTO

Posted by emadmagdy on July 13, 2007

An Easy way to add an Identity column to a table created by SELECT .. INTO is:

 

Assume the table is created using

SELECT NAME INTO NAMES2 FROM NAMES1

 

simply add this,

SELECT IDENTITY(INT, 1,1) AS [ID], NAME INTO NAMES2 FROM NAMES1

Posted in Uncategorized | Leave a Comment »

log4net and .NET 2.0 Gotcha

Posted by emadmagdy on July 12, 2007

A single line makes all the difference when using log4net with .NET 2.0

 

log4net.Config.DOMConfigurator.Configure();

If this line is not included, log4net will not work at all.

 

more details in this posting

Posted in Uncategorized | Leave a Comment »

Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.

Posted by emadmagdy on July 8, 2007

This Exeption may rise when trying to Fill a table using a Table adapter.

 

One of the reasons this may happen is if the SQL statement is not Selecting a column that is not null in the DB

for example :

if table has field1, field2, field3 and all do not allow null, This exception will be thrown if you try SELECT field1, field2 from Table.

 

Of course, there may be other reasons for the excption like actually violating a constraint :)

Posted in Uncategorized | Leave a Comment »