background preloader

ASP

Facebook Twitter

Handleerror

Primary Objects - Designing Software with Generics and Reflectio. A .generic software design is a way to refer to a class or library by using an interface name that the class inherits from, rather than using the class name itself. By decoupling the main code from the details of the class, and using its interface instead, we can deal with a set of different classes in the same way. To really show the power of C# ASP .NET generics and reflection, an example is needed. We'll use the famous Hello World example, but within a .NET generics/reflection framework. Classic Hello World Example In the classic version of a Hello World application, we simply print text to the console. Void main(){ HelloWorldOne MyHelloWorldOne = new HelloWorldOne(); MyHelloWorldOne.SayHelloWorldOne(); HelloWorldTwo MyHelloWorldTwo = new HelloWorldTwo(); MyHelloWorldTwo.SayIt();} public class HelloWorldOne(){ public void SayHelloWorldOne() { Console.WriteLine("Hello World!

") public class HelloWorldTwo(){ public void SayIt() { Console.WriteLine("Hello World Again! ") Console.ReadKey(); } } Open Source Charting & Reporting Tools in C# Pete Sheill : XML Serializing a Hashtable or generic Dictionary. How to delete duplicate records or rows among identical rows in. It is a very common situation that you may find yourself against a problem dealing with deletion of dublicate records in a database table. This is a real problem if the records are identical even for values in each column. So you can not distinguish one row from the other. This problem may occur on any table if the table does not have a unique index or an identity column. Unique indexes guarantees that columns within the index has no dublicate values so each row in the table has also no dublicates.

But now we will deal with a situation where we can not avoid dublicate records in a table and try to remove or delete the dublicate rows from the database table. There are three methods that we can get use of them in order to delete dublicates in a table. Before I explain both methods, it is better to create a table that will help us simulate the problem. CREATE TABLE Users ( FirstName nvarchar(50), LastName nvarchar(50) ) GO SELECT * FROM Users Method 1: SET ROWCOUNT OPEN dublicate_cursor. Dynamic data pages: showing lists : CSharpFeeds. Demystifying DLINQ: Part3 - Querying for Data using DLINQ | Sahi. Welcome to Part 3 of my DLINQ series. Following are what we have already seen – a) Demystifying DLINQ: Part1 - An introduction to DLINQb) Demystifying DLINQ: Part2 - Setting up a DataContext Class In this post, it made sense to solidify our understanding by first creating a DataContext on (what else) the NorthWind database, and secondly to use that DataContext in a few real queries and try and understand what exactly goes on behind the scenes, plus, get a practical understanding as far as “Select” queries go.

So, go ahead and setup your strongly typed DataContext using the following command – C:\>"c:\Program Files\LINQ Preview\bin\sqlmetal" /server:. /pluralize /database:Northwind /code: Northwind.cs Now create a ConsoleApplication – preferably a LINQConsoleApp (so all the references are added for you), and add the NorthWind.cs file to your console application. Awesome !! Northwind db = new Northwind(connStr) ; var customers = from c in db.Customers select c ; Now rewrite the query as below -