November 30, 2001

Consistent Error Handling in SQL Server

Suppose you need to tack on an additional value to all your custom errors in SQL Server 2000. For VB programmers, that might mean tacking on the value of vbobject error to all SQL errors in order to remain consistent throughout your application. To do this, you’ll need to create

Managing Custom Errors in SQL Server

Creating Custom Errors in SQL Server is not a hard thing to do, but managing those errors across multiple developers can be difficult. The question becomes: who has already used what custom error? This often leads to hours of wasted time. To make things easier, centralize all of your error

A Universal Delete Stored Procedure that Deletes Records from any Table

This stored procedure accepts tablename, fieldname, fieldvalue andfieldtype as parameters. If no fieldname, fieldvalue is passed, it deletes all records from the table passed. Fieldvalue could be a single value or list of values delimited by a comma. If fieldtype is NULL or 1 it will consider the datatype of

Never Use L”” to Create a BSTR

When you call a COM method, it accepts BSTR in the following way: Iface->f(L””) L”” does not create a BSTR. This just creates a wide character string and if the string has to be marshalled to another apartment, the method will fail. Such usage will result in hard to find

Open a DOS Command Window from any Folder in Explorer

If you still use a lot of DOS commands or execute batch files that you have acquired or written over time, this tip can save you a lot of typing. Many administrators and co-workers have thanked me for this tip, so I thought I would share it. Normally, when you

Use Math.PI and Math.E for Scientific Calculations

Many scientific/trigonometric/mathematical applications need the values of ‘pi’ and ‘e’ (the basis of natural logarithms) for calculations. The math class in the java.lang package has two static double constants that represent values that are closer than any other to these. They can be used in calculations.Since they are static, they

Many Primary Keys for a Single Table

Have you ever wanted to have 1:1 relation between tables (i.e. a table in which two columns act like primary key not combined but separately)?DB only supports a single column, or group of columns, as primary key. How do you get primary key behavior for 2 columns in DB? Define

When to Declare a Virtual Member Function Private

Declaring a virtual member function private may be useful when you wish to limit the number of derived classes that can override the given function. In such a case, you declare all the derived classes, which will be able to override the private virtual member function as friends of the

Creating an Executable (Double-Clickable) jar File

Oftentimes, an application is packaged as a jar file. Ususally, you have to use a command line option to execute it. It would be easier to double click on the jar file to get the application to run, instead of typing a command. To do this, you need a manifest

No more posts to show