devxlogo

The Latest

BigDecimal Numbers and Formatting

[float]s and [double]s are useful for graphics and possible statistics.However they are not recommended for certain calculations requiring absoluteaccuracy, such as when they involve money . That’s because the results

Range of Ports Available to ServerSockets

The java.net.ServerSocket class implements a server socket. A server socket waits for requests to come in over the network. It performs some operation based on that request, and then possibly

Sorting Arrays of Primitive Types

Sorting arrays of primitive types (byte, char, double, float, int, long, and short) is easy.Example: import java.util.*;import java.awt.*;class SortDBL // Sorts an array of randomly generated double values.{ public static

The Comparable Interface: [java.util.Comparable]

This interface defines the way in which objects are to be compared. Anobject that implements this can be sorted as easily as any primitive, such asthe [String] class… import java.util.*;import

‘Wait Please…’ Implementation

It is a common task for servlet (JSP) developers to have to display something with a server-based operation (calculation) that wastes a lot of time. Suppose you have a very

Benefits of Using PLS_INTEGER Datatype in PL/SQL

If you have a whole-number counter, for example in a loop or record counter, consider using a datatype of PLS_INTEGER instead of INTEGER or NUMBER. When declaring an integer variable,

Use java.lang Methods as Functions with SQL-J

You can use methods of java.lang classes for all of the functions found built-in to other databases. For example, you can call the static method java.lang.Math.abs, which is similar to

Clean Quotes From SQL Parameters With Replace

If you’ve ever used SQL commands against the ADO Connection object, you might have had a problem allowing the user to enter text that contains an apostrophe: ADOCon.Execute “Insert Into

Sort DBGrid Contents With Recordset Refresh

It’s often useful to sort a DBGrid field in either descending or ascending order. You do this by using the HeadClick event and the DataField property of columns. You must

Optimize Parametrized Queries With ADO Objects

When you write Insert statements, it can be difficult to accommodate the possible values end users might enter into a textbox. The most common task is replacing single quotes with

Dynamically Populate MSFlexGrid Control

If you use an MSFlexGrid control to display data returned in an ADO recordset, you can use this code to dynamically populate the grid?including the header row?with the information in

Fix Justification Glitch in MSFlexGrid

The MSFlexGrid tries to automatically determine how to justify text. If the first character is numeric, then that cell will be right-justified. If it is an alphanumeric character, then that

Handle Advanced Arrays With RDS

Often you need a data structure similar to a two-dimensioned array or collection, but you need to manipulate it. For example, you need to sort on certain columns, filter certain

Edit Field in DataGrid on F2

Sometimes you want to give your DataGrid the ability to edit fields, while the original data in the field is highlighted. Normally, you can click on the field to start

Retrieve Recordset Fields Faster

Suppose you have a table with this field: Customer_Code You can retrieve the field in many ways: rs.(0)rs(“Customer_Code”)rs.fields(0)rs.fields(“Customer_Code”)rs.fields.item(0)rs.fields.item(“Customer_Code”) In VBScript, the versions that use field indexes instead of names are

Undocumented Boolean Field Constant

Consider the Data Definition Language statements: “ALTER TABLE [My Table] ADD COLUMN [My New Field] Single” and “ALTER TABLE [My Table] ADD COLUMN [My New Field] Double”. According to Microsoft

Export Records to CSV File for Excel

Most of my end users use laptops, which can have a wide variety of spreadsheet software installed. I often use this function when working with database tables or queries to

Use Tag Property in SQL Statements

When building SQL statements, use the Tag property to hold the Field Name and Data Format. I use a naming convention of str, int, dat, and so on to determine

Take Advantage of Remote Data Services

If you can be sure that your users are only running Internet Explorer 4.0 or higher, you can take advantage of Remote Data Services (RDS), now part of MDAC 2.x.

Getting Recordsets With Remote Data Services

There are basically two ways to get recordsets with Remote Data Services (RDS). You can either use the system-provided RDSServer.DataFactory object or you can write your own full-blown custom business

Counting the Number of Records in a Recordset

One of the handy features of working with the ActiveX Data Object (ADO) is the ability to load the results of SQL select statements into a Recordset. Once you have

Encapsulate Your Code

One of the most common mistakes developers can make is to extensively use global variables. While they are sometimes necessary, global variables can cause problems in code that are both

Changing Style Attributes Dynamically

Microsoft’s IE4 supports the ability to change just about any CSS1 style attribute dynamically. To access an element’s style, use the style object property that corresponds to the style attribute.