Where Vs Having In SQL

21-05-2012 The Having clause can only be used when you are using the group by phrase. When you are using the Group By phrase in a query, you can use the Having clause for pretty much everything you can do with the Where clause. But not vise versa. The where clause doesn’t support aggregate functionsContinue reading “Where Vs Having In SQL”

Use of “as” keyword as for casting in C#

2009-01-06 The keyword as doesn’t throw an exception if it fails to complete the casting operation. Instead it will return null. Other casting operations will throw an exception when the provided value cannot be casted. Since the “as” keyword sets or returns “null” value when it fails, the variable you use must be of aContinue reading “Use of “as” keyword as for casting in C#”

Using DispatcherTimer To Create A Timer In WPF

09-03-2012 // http://pagead2.googlesyndication.com/pagead/show_ads.js WPF doesn’t have a straightforward Timer control that you can drag and drop from the Toolbox. However, ther’s still a straightforward easy way to implement this. You can use the provided System.Windows.Threading.DispatcherTimer class for this It’s easy as abc. Steps: 1 Create an instance System.Windows.Threading.DispatcherTimer TimerName = new System.Windows.Threading.DispatcherTimer() ; 2 CreateContinue reading “Using DispatcherTimer To Create A Timer In WPF”

Using TextEditSettings.DisplayFormat To Format Your Data In DevExpress DataGrid

07-03-2012 // http://pagead2.googlesyndication.com/pagead/show_ads.js Devexpress doesn’t provide much information about how you can use this to format your data when you use DevExpress DataGrid. I have a code to create and format a devexpress datagrid dynamically at run time. I had to automatically format date to match the British system if the current data is ofContinue reading “Using TextEditSettings.DisplayFormat To Format Your Data In DevExpress DataGrid”

How To Choose Between ItemsSource and DataContext

2012-02-24 // <![CDATA[ google_ad_client = "ca-pub-5478118713208336"; /* LeadIn */ google_ad_slot = “2638602320”; google_ad_width = 468; google_ad_height = 15; // ]]> http://pagead2.googlesyndication.com/pagead/show_ads.js I usually use ItemsSource property when I need to databind a control in WPF because it’s straightforward and the framework does everything for me. However, I came accross a situation where I had toContinue reading “How To Choose Between ItemsSource and DataContext”

How to use LIKE operator in Dataview.RowFilter for Date Time or Numaric Fields using CONVERT

2012-01-16 // http://pagead2.googlesyndication.com/pagead/show_ads.js The RowFilter property of the DataView allows to use flexible string similar to SQL or LINQ to easily filter rows wihtout having to iterate through them. I had to implement a fully flexible search module for a project I’m working on. The user had to be able to perform a string searchContinue reading “How to use LIKE operator in Dataview.RowFilter for Date Time or Numaric Fields using CONVERT”

Using TimeStamp columns to keep track of database record versions

2011-10-07 // http://pagead2.googlesyndication.com/pagead/show_ads.js Timestamp is a value that is incremented by the database whenever an insert or update operation is performed. Even though the name Timestamp could be a bit misleading, this value has no relevance to a clock related time. This only shows a linear progression of time. For an example , it isContinue reading “Using TimeStamp columns to keep track of database record versions”

How to use (escape) single quotation mark in sql statements

06-10-2011 // http://pagead2.googlesyndication.com/pagead/show_ads.js We all get that day when we get an exception complaining about the single quotation or apostrophe that was in our SQL statement. The best advisable thing to do is to use stored procedures so that all data are passed as parameters. However there are situations we have to use in-line SQLContinue reading “How to use (escape) single quotation mark in sql statements”