The ASP Emporium
Free Active Server Applications and Examples by Bill Gearhart
Online since Friday January 7, 2000

 home > code > classic asp apps > Connecting to a Database and Retrieving Results in 9 Easy Steps

enter a phrase to search:(advanced search)


 h o m e 

 w h a t 's  n e w 

 a l l   c o d e 
  .net:
    • Fundamentals
    • C# Classes
  classic asp:
    • Code Library
    • ASP Apps
  general:
    • Tutorials
    • SQL

 d o w n l o a d s 

 u s e r   f o r u m s 

 l i n k s 

 s e a r c h 

 s u p p o r t 


Connecting to a Database and Retrieving Results in 9 Easy Steps

Now everybody can connect to a database. Simple database access is a huge feature of ASP and one of the most widely used by developers but when you are first learning, it's hard to separate the database stuff from the rest of the code so I made this example.

The output of this example is written below. The html is poor at best...

16 records found!

exampleID exampleName exampleDesc examplePathName exampleLanguage firstCreatedDate lastModifiedDate isNew isUpdated
54 IP Address Filtering and Restriction System Finally, hardcore IP address filtering software for ASP! This example acts as an IP filter for your website. You can block single IPs or spans of IP's (like entire dsl networks, etc...) to accomodate an annoying user's hiccuping IP address. This system is production level and works on any asp file in any IIS website with no recoding. Implemented completely in JScript and allows an unlimited number of IP addresses or spans of IPs to be blocked via blocked IP rules stored in a database. You don't need to add to or recode any of your existing ASP files to protect them! IPRestrictor jscript 5/1/2001 2/18/2003 9:06:00 PM True False
38 @@IDENTITY Did you ever need to add a record to a table in your database and then retrieve the Identity or AutoNumber field of the record you just added? MS Access and SQL Server both support using the @@IDENTITY function to do just that. getLastIdentity jscript 2/28/2001 2/18/2003 9:06:00 PM False False
50 Browser Object Sometimes it's handy to be able to determine what browser your user's are visiting your site with... so I wrote a JScript object to do just that. Just like most of my other JScript examples, it does almost all of it's string parsing with regular expressions (and stands as a testament to how powerful regular expressions are...). As a little bonus, this object will make a guess as to whether or not your browser is a robot (and you can control how sensitive that guess is)... browser_object jscript 3/9/2001 2/18/2003 9:06:00 PM False False
39 CreditCard Object Validate credit card data thoroughly using JScript and regular expressions. This is a port of the CCVerification Object that has a few bonus features that the VBScript versions don't have, including the ability to automatically determine the type of card based on the entered number! creditcard_object jscript 2/16/2001 2/18/2003 9:06:00 PM False False
45 Formatting US Currency using regular expressions Sometimes it's useful to verify is US currency is formatted correctly according to the major standard used by retailers and stores. This regular expression tests a currency value to ensure that it has all the major parts. isCurrencyFormatted jscript 2/13/2001 2/18/2003 9:06:00 PM False False
52 Parsing HTML and ASP Files With Regular Expressions Seven functions for parsing strings that represent HTML or ASP pages... Uses JScript and regular expressions to do most of the tough stuff. html_parsing jscript 4/10/2001 2/18/2003 9:06:00 PM False False
42 Reading Files Read files and directories with the Scripting.FileSystemObject and JScript. file_read jscript 8/11/2000 2/18/2003 9:06:00 PM False False
41 Reading From A Database This function simply gathers the titles of all vbscript examples from the ASP Emporium database's "examples" table using JScript instead of VBScript. database_read jscript 8/11/2000 2/18/2003 9:06:00 PM False False
44 Reading INI Files Read key values from specific headers in an INI file using the FileSystemObject and JScript. getINIValue jscript 2/13/2001 2/18/2003 9:06:00 PM False False
49 Useful date functions for Jscript Add the isLeapYear and getDaysInMonth function to your JScript Date processing arsenal. jsDates jscript 2/13/2001 2/18/2003 9:06:00 PM False False
46 Validating absolute directory paths using regular expressions Make sure that file or directory paths are properly syntaxed using regular expressions and JScript. validateDirPath jscript 2/13/2001 2/18/2003 9:06:00 PM False False
43 Validating Email Addresses Validate an email address using regular expressions. This newest implementation adds a second step to the validation to check the end of the email address against all known top level domains to ensure that the email is that much more valid. emailValidation jscript 8/23/2000 5/6/2001 False False
48 Validating US Social Security Numbers with regular expressions If you're recording SSN's from your clients, validate them to ensure that they have proper syntax. isSSN jscript 2/13/2001 2/18/2003 9:06:00 PM False False
47 Validating US States with regular expressions This function will validate all 50 valid US state abbreviations as well as DC. isUSState jscript 2/13/2001 2/18/2003 9:06:00 PM False False
37 Viewing the stored procedures in a database If you are using SQL Server, you have a guaranteed way to view all your stored procedures using two globally-available system objects: the built-in sysobjects system table and the sp_helptext system stored procedure. MS Access users, it's time to upgrade to SQL Server! sysobjects jscript 2/28/2001 2/18/2003 9:06:00 PM False False
40 WinPath Object Return information about and test absolute directory paths to files, folders or drives ... winPath_object jscript 2/13/2001 2/18/2003 9:06:00 PM False False