Browse by Tags

All Tags » C# (RSS)

Solution 6 : Kill a Non-Clustered Process during Two-Node Cluster Failover by StanleyGu

Using Visual Studio 2008 and C#, I developed a windows service A and deployed it to two nodes of a windows server 2008 failover cluster. The service A is part of the failover cluster service, which means, when failover occurs at node1, the cluster service...
Filed under: , ,

Tip 16 : Open Multiple Documents within Single Application Instance Using C# by StanleyGu

1. Using Microsoft Word 2007 as an example, you can open test1.docx and test2.docx at same time. The two documents are opened within single instance of the word application. World application supports command line argument of passing multiple documents...
Filed under: ,

Tip 14 : Solve SmtpClient issues of delayed email and high CPU usage by StanleyGu

1. It is quite straightforward using SmtpClient class to send out an email 2. However, when you step through the above code executing smtpClient.Send(), you will notice about 2 minutes delay in receiving the email. 3. My first try to solve the issue of...
Filed under: ,

Tip 13 : Kill a process using C#, from local to remote by StanleyGu

1. My first choice is always to try System.Diagnostics to kill a process 2. The first choice works very well in killing local processes. I thought the first choice should work for killing remote process too because process.kill() method is overloaded...
Filed under: ,

Architect 3 : Building Data Access Layer Using Microsoft Enterprise Library 4.1 by StanleyGu

You have a Customer table with three fields: ID, LastName and FirstName. You are building a data access layer to retrieve all the records from the Customer table and return the result as a collection of Customer objects. You want implement it using Microsoft...

Solution 5 : Implementing Optional Parameters in T-SQL Stored Procedures by StanleyGu

You have a stored procedure GetCustomers with two parameters: LastName, FirstName. The stored procedure returns all the records matching the values of the parameters. You want the parameters be optional, which means skipping the parameter if you do not...
Filed under: , ,

Tip 10 : Returning the first part of a string with delimiter by StanleyGu

You have a string delimited by underscore such as 1stPart_2ndPart_3rdPart and want to return the first part of the string only. C# Implementation of using Split function: T-SQL implementation of using SUBSTRING and CHARINDEX functions:
Filed under: , ,

Tip 8 : IsDate() function in C# by StanleyGu

C# does not provide IsDate() function, but you can build one pretty easily: You can build other functions such as IsInteger() by using int .Parse() instead of DateTime .Parse(). Based on feedbacks from the community, I am adding an alternative using TryParse...
Filed under: ,

Architect 2 : Calling WCF Services in Your Data Access Layer by StanleyGu

After you have completed an N-tier Silverlight application (check my blog: http://weblogs.asp.net/stanleygu/archive/2009/12/20/building-n-tier-silverlight-application.aspx ), your company decides to outsource sql server database development and management...

Architect 1 : Building N-Tier Silverlight Application by StanleyGu

You have a Customer table with fields of LastName and FirstName, and want to use Silverlight DataGrid to display all the records. To implement this, You can use N-tier application architect. 1. The N-Tier Silverlight application consists of following...
More Posts Next page »