November 15, 2003

Write a Primary Key Class in CMP EJB

In the following example, the PurchaseOrderKey class implements a composite key for the PurchaseOrderEJB entity bean. The key is composed of two fields, productModel and vendorId, whose names must match two of the persistent fields in the entity bean class. public class PurchaseOrderKey implements { public String productModel; public

Override Built-in Keywords

You can override some of the built-in VB keywords with your own version of the function. For instance, FileDateTime is a handy built-in function in VB, but it suffers from one big problem: It cant set the date/time of a file. By overriding the built-in function, however, you can provide

Automate Your Classic ASP Web Forms

TML form handling consists of a set of named form controls on an HTML page and a Submit button for sending the information contained by the controls to a server, which presents a confirmation/summary page to the user, validates the information and then updates a database. Most important forms insert

Get the Average Value Across the Columns by Using the AVG() Function

CREATE TABLE tblSales (MonthNumber int,MonthName varchar(10) PRIMARY KEY,ProductA INT,ProductB INT,ProductC INT) INSERT INTO tblSales Select 1,’Jan’,5800,5900,5400 union allSelect 2,’Feb’,5750,5950,5500 union allSelect 3,’Mar’,6200,5700,7100 union allSelect 4,’Apr’,6300,5900,5400 union allSelect 5,’May’,5350,5650,5500 SELECT A.*,X.AvgSales FROM tblSales A inner join(Select MonthName,Avg(Sales) AvgSales from(select MonthName,’A’ Product,ProductA Sales FROM tblSalesunion allselect MonthName,’B’ Product,ProductB Sales FROM tblSalesunion allselect

Compare Oracle and SQL Server Dates

Oracle and SQL Server databases use different date/time resolutions, which poses a problem when you compare times from the two databases: The times will rarely be equal. Solve this problem by allowing for a margin of error. Treat the dates and times as floating-point numbers and remember that each day

Use the RegNotifyChangeKeyValue API for Receiving Notification Messages

Windows applications generally use the registry for storing configuration information. Sometimes, it can be essential to allow users to change the registry key/value and the same needs to be reflected by the application dynamically (without restarting the application). This is where RegNotifyChangeKeyValue comes to the rescue. This API notifies the