May 14, 2002

How to Create and Use CallableStatement Objects

A CallableStatement object provides a standard way for all RDBMS’ to call stored procedures. A stored procedure is stored in a database; the call to the stored procedure is what a CallableStatement object contains. This call is written in an escape syntax that can take one of two forms: with

Send NET SEND Messages

This code is how to send NET SEND messages to all the connected SQL Server users in an NT local area network: CREATE PROC notify_users(@notification VARCHAR(100) = ‘SQL Server shutting down’)ASBEGINSET NOCOUNT ONDECLARE @msg VARCHAR(250)DECLARE @hostname sysnameSELECT @hostname= min(RTRIM(hostname))FROM master.dbo.sysprocesses (NOLOCK)WHERE hostname ”WHILE @hostname is not null BEGIN set @msg=’exec

Passing Arrays by Value

It has already been said many times that (a) std::vector is preferred to c-style arrays, and (b) Arrays, vectors, and other data structures should preferably be passed by reference.While this is sound advice in the general case, there may come a time when you want to pass a c-style array

Making a Class Final

The following code explains how to make a class that is final, meaning that it cannot be derived further. class FinalBase{ FinalBase() {} friend class Final;};class Final : private virtual FinalBase{};

Save Expensive Heap Allocations

Fixed-size arrays in local variables use a stack-allocated descriptor as expected, but all the data for an array is allocated on the heap. However, fixed-size arrays embedded in structures are fully stack-allocated. This means that you can save yourself expensive heap allocations by defining a (Private) type with a single

Execute Parametrized QueryDefs Simultaneously in DAO

In Microsoft Access, you can execute a parameterized query that uses other parameterized queries, as long as their parameter names are the same. Save these queries in an Access database: “QueryOne” PARAMETERS MyDate DateTime;SELECT Date1 FROM TableOne WHERE Date1>MyDate;”QueryTwo”PARAMETERS MyDate DateTime;SELECT Date1 FROM TableTwo WHERE Date1>MyDate;”QueryUnion”PARAMETERS MyDate DateTime;SELECT * FROM

Convert Dates without the Use of Separators

Sometimes the user forgets to enter a date with date separators. A good way to deal with this is to correct the users mistake instead of forcing the user to enter the date again. To correct the date, take the locale date format sting into consideration. You can retrieve it

Allow Context-Sensitive Help for Disabled Controls

If you want a form to support context-sensitive help, set the WhatsThisButton and WhatsThisHelp properties on the form to True, and set the WhatsThisHelpID property to a corresponding help-file topic ID for any control on that form for which you want help to be displayed. Unfortunately, the help isn

No more posts to show