Archives

Archives / 2009 / August
  • Using Parameters with Dynamic SQL

    Some programming situations require you to use Dynamic SQL. Of course the problem with using Dynamic SQL is that this can lead to SQL Injection attacks. However, you can avoid these problems, by just changing how you submit Dynamic SQL to your back end database.

  • Cloning a DataRow

    I can't even tell you how many times over the last few years I have had to clone a row from one DataTable to another DataTable. To make this easier, I created a method that I can call at anytime to create this new DataRow and return a new DataTable back to me. I have another overload of this method that I can also pass in the new DataTable. In ADO.NET there is no easy way to take a single row from an existing DataTable and copy it to another DataTable. The major reason why it is not so easy is you can not add a DataRow that exists in one DataTable to another DataTable. As a result you must create a new DataRow object and copy all of the values from the original DataRow into this new one. You can then create a new DataTable (or use one with the same structure), and add that DataRow to that new DataTable. Below is a method that you can call to accomplish the copying of a single row from one DataTable to a new DataTable.

  • About Nothing

    Sometimes in your code you will need to check to see if a value is nothing/null or not. In .NET there are many different ways to check for this condition. It can also be different depending on the language you use. These little differences can really bite you in the a**, so you need to be aware of the differences.

  • To Thread or not to Thread, Is That the Question?

    A lot of developers want to use threads to offload some processing. There are many different ways to use threads. More often than not it is not a question of how to do threading, but whether or not you should. If you are trying to solve performance problems with your application, you might not want to employ the use of threading, at least not until you have exhausted all other methods of enhancing performance.

  • Why you Should Move to WPF

    If you have not taken a look at WPF yet, you really should. WPF is a great desktop development platform. Granted all of the of the tools are not yet in place, but Microsoft is pouring millions of dollars into developing WPF tools. Windows Forms is now considered a legacy technology and will no longer be updated. These two reasons alone are enough to convince you that you should start taking a little more than a serious look at WPF.

  • Why Do I Need OOP?

    Most developers have been doing some form of Object Oriented Programming (OOP) for quite awhile now. Sometimes you might not even realize it. If you have been using VB 6 for example, then every control is a class, and you interact with it as an object by setting properties and calling methods on those objects. All you need to do now is to start creating your own classes, properties and methods.

Past Blog Content

Blog Archive