|
Working with ASP
GarageApartments.com
was built while I was learning ASP and SQL. This section provides
some very useful information I found while building
this site. Hopefully my experiences will save you
some time as you build your site. All SQL statements work with Access.
ASP
Working with the
apostrophe - The apostrophe in ASP can be
annoying. Basically, If you want to return an
apostrophe to a page it must be a double
apostrophe.
Here's the work
around:
In this example we are
using the replace function to search a variable for
a single apostrophe and replace it with a double
apostrophe. The result is then set back to the
same variable name. Again this is only
required if lname will be used in a Response.Write()
to a webpage.
Example-> lname = replace(lname, "'", "''")
SQL
Randomizing SELECT
results - I was looking for an ORDER BY that
will would randomize the results of my select
statement. Finding the built-in function for
Access took some time, but it is extremely simple
Here's what you do:
This simple you just
use the function rnd() after ORDER BY in your SELECT
statement. In the function you need to include
a field that contains your unique numeric key. In
the example below prpid is the field in my database
that contains my key.
Example-> SELECT * FROM property ORDER BY
rnd(prpid)
As I stumble upon
additional solutions I will post them here.
Best of luck in your web programming adventures.
|