December 20, 2000

Insert a picture into a RichTextBox control

Here’s a simple method to programmatically insert an image into a RichTextBox control, by copying it into the clipboard and then pasting it into the control: Private Declare Function SendMessage Lib “user32” Alias “SendMessageA” (ByVal _ hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, _ lParam As

Determining an Absolute Row Index

Often properties and methods associated with grid controls don’t provide an absolute row index of current or selected rows (relative to the actual first row and not the first displayed row). The sample code below provides the index of the current row, assuming the absolute first row has an index

Wait to Instantiate COM Objects in ASP Pages

When you are unsure if you need to instantiate an object from your ASP pages, as in the case of instantiating a COM object to access SQL Server, it is better not to use the Server.CreateObject method. This method creates an object immediately. Why go to all the trouble of

Use adExecuteNoRecords in the ADO Command Object to Boost Performance

If you need to execute a stored procedure from a Command object, and the stored procedure will not return any rows, you can boost performance of the Command object by setting the adExecuteNoRecords option. This tells the Command object to not ask for a returning rowset, which saves a little

Don’t Cache ADO Database Connections in the ASP Application Object

If you do, then all the pages will fight for the use of this connection. In addition, don’t cache an ADO connection in the Session object. If you do, a database connection will be created for every user, defeating connection pooling and overusing server resources. Instead, ADO connections should be

Be Careful How You Name SQL Server Stored Procedures

When creating stored procedures in a database other then the Master database, avoid using the ‘sp_’ prefix. System stored procedures are the only ones that should use the ‘sp_’ prefix. The issue is not that naming a procedure in this manner causes errors executing the procedure, but rather it slows