August 8, 2000

Escaped Characters

Question: When defining a string, is there a way to include a carriage return in the text? Answer: Yes. A carriage return is represented by the special escapedcharacter . However, make sure that if you really wanta line separator, and not a carriage return, that you query the line.separatorproperty using


Question: I’ve archived/purged a few thousand rows of unnecessary data, but the disk space reading hasn’t changed. Do I need to use the ALTER TABLE command to reclaim empty space from deleted rows? Answer: When rows are deleted, the space is not reclaimed until the table is rebuilt. An easy


Question: Most GUI examples show System.exit(0) as the window closing eventhandler. However, System.exit(0) is a bad way to exit applications.The specification says that the VM will exit when all the non-daemonthreads have finished. How can this be implemented so as to avoid thehard exit of System.exit(0)? Answer: The reason most

Software Required to Make ASPs

Question: Which software is required for Active Server Pages development? Answer: Internet Information Server (IIS) is the most common way to implement ASP, but there are other plug-ins available for other platforms.

Listing Available Tables

Question: How do I list the available tables in a database I’m querying? Answer: You can get a list of tables in a database by calling the INFORMATION_SCHEMA.Tables view like this: SELECT * FROM information_schema.tables This returns the name of the current database, the owner, the table name, and the

Return ID in Same Query as Insert

Question: How do I write a query that does an insert and returns the newly assigned ID from that field, all at one time? Answer: The @@IDENTITY variable returns the identity value for the last inserted record. You can insert a record and it selects the @@IDENTITY value, like this:

RecordCount Property-ADO

Question: How do I get the rowseffected from the execute method of an ADO command object?The code I’ve written is: Dim Cn as New ADODB.ConnectionDim Cmd as New ADODB.CommandDim Recordset as New ADODB.RecordsetDim lintRecEffected As IntegerCn.Open “some connection string”Cmd.ActiveConnection =CnCmd.CommandType=adCmdStoredProcCmd.CommandText = “SelecRecords: Set Rs=lcmd.ExecutelintRecEffected)msgbox lintreceffected This shows -1 even though

Distribution List E-mail Stuck in Outbox

Question: When I try to send e-mail to the distribution list, it gets stuck in outbox. What should I do? Answer: I’d start by verifying that all of the addresses in the distribution list are correct. A typo or incorrect address may be causing address resolution to fail and thus

Counting Duplicate Rows

Question: How do I count the number of duplicate items in a table? Answer: Lets break down your question into several steps.First, let’s create a sample table using the following code: create table dups( i int)godeclare @i intselect @i = 0while (@i < 35)begin insert into dups(i) values (cast (rand()

No more posts to show