|
Complete Computer Services We accept: Paypal, U.S. & Canadian money orders, U.S. checks Shipping shown is the maximum you pay PER ORDER, not per item. Discounts are applied after we receive your order.
The more you order, the LESS shipping you pay. |
Don't forget to claim up to five free bonuses! Flat rate shipping regardless of order size Free software and Free cartridges Discount for non credit card payment Secret bonus for repeat customers and referrals bonus details |
Introducing CCS:
Home - This is Your site
CCS Since 1983
Customer service
Customer Testimonials
Sales terms and conditions
How To Order
Orders and inquiries
Outside U.S. & Canada
FREE bonuses
Our Privacy Policy
Solving Ink Cartridge Problems
Best telephone line deal ever!
Less than $5 a month!
TWO unlimited calling phones lines for TWO years for $199!
Limited time introductory offer! 

E-onlinedata Merchant accounts
Phone lines for under $5 a month!
Merchant Accounts: Important Info
What's in your drinking water?
Free program cleans your monitor
100 Cool Tools for Web sites
Encrypt Your Email ID
Burn DVDs to CDRs
Post Office in your home
The Ultimate Business
Auction Guide
Payment service ratings
your own domain & web site: $6/month
Quick Guide: Troubleshooting A PC
Sites with Great Customer Service
Don't Get Scammed - Warnings
Beyond HTML - Server Side Includes
What is ASP?
Digital camera resolution explained
Photos at Different Resolutions
Choosing A Digital Camera
Using A Digital Camera
Digital Camera Reviews
Articles, Fiction, Jokes
Humor, Games, Other Interesting Sites
Visit our other site for stories, jokes & creative expression
Food For Thought
Exchange links with us. Email
Change the background of this page
What Is (Are) ASP? (continued)
by Yisroel Goodman
Below is an example of the code used in creating the main page of our online catalog. ASP commands are preceded by the less than sign < followed by a percent % and end with a percent followed by a greater than sign >. I used ^^ to keep your browser from attempting to execute the commands here. I also replaced the brackets on the HTML commands. So while the syntax isn't perfect, you can get the idea.
^^ LANGUAGE = "VBSCRIPT" ^^
This is server side code, so it belongs in vbscript
^^ OPTION EXPLICIT ^^
This tells vbscript to report an error if a variable is referenced that has not been declared with DIM (see later). It is a good idea to do this. Suppose you create a variable called itemno and later you accidentally refer to itemnum. With Option Explicit, you will be given an error since itemnum does not exist. Without it, the program will continue processing but you will get the wrong results.
[html]
[head]
[title]CCS Products[/title]
[/head]
[body]
[table width="600"]
[tr]
[td width="450" valign="top"]
(I placed the code for the page heading here.)
# INCLUDE file = "adovbs.inc"
A nice feature is that you can include another file into the current file. It saves copying, pasting and editing numerous files. This particular file contains parameters for accessing databases in ASP.
^^
start of vbscript code. The DIM statement simply declares variables to be used later.
Dim rsWorkgroup, dbConn, strSql, sConnectstring, i, db_file, reclink
The line below uses a specific server variable to determine what server the asp page is on. It then appends this to the database name. Otherwise it will look on the user's C: drive for the database and that is not where it is.
DB_File = Request.ServerVariables("APPL_PHYSICAL_PATH")& "xxx.mdb"
The line below instructs what kind of database connection is needed, which varies depending on the data type (Access, SQL)
sConnectstring = "provider=Microsoft.Jet.OLEDB.4.0;data source=" & DB_File & ";"
The next few lines create a database connection and a record set of returned records
Set dbConn = CreateObject("ADODB.Connection")
set rsWorkgroup = createobject("ADODB.Recordset")
dbConn.open sConnectstring
strSql = "select * from items order by category, item"
rsWorkgroup.open strsql, dbConn ^^
Here come standard HTML commands to create a table with a heading and the company logo.
[table border = "1" cellpadding = "0" cellspacing = "0" width="700"]
[tr bgcolor="#EEEEEE"][td][img src="/ccs.jpg" width="170" height="120" alt="CCS Logo"][/td][td colspan=67]
[tr bgcolor="#CCCCC"]
[td]Category[/td]
[td colspan=3]Click for details[/td]
[td colspan=28]Description[/td]
[td]Price[/td]
[td colspan=43]Availability[/td]
[/tr]
Now that the record set has been returned and a table created to display the results, the next lines go through the returned records and display the values in the table.
Note that ASP code is interspersed with HTML code. ASP will create HTML pages and insert the results of the ASP code in these pages. Look at the first line under While not rsworkgroup.eof. Assuming that the value of rsworkgroup.bgcolor (a field in the database) is #CCFFFF, and rsworkgroup.category is Battery, ASP will create html code which will read:
[tr bgcolor="#CCFFFF"] [td] Battery [/td]
The field reclink will contain an HTML link to a page called showitem.asp and pass to it the item name and description. When the link is clicked, Showitem.asp will look up that item in the database and display a whole page for that item, with details and pricing.
^^while not rsWorkgroup.eof ^^
[tr bgcolor="^^=rsworkgroup("bgcolor") ^^"] [td]^^=rsWorkgroup("Category") ^^[/td]
[td colspan=3]
^^ reclink = "showitem.asp?itemid=" & rsworkgroup("item") & "&itemdesc=" & rsworkgroup("desc") ^^
[a href="^^=reclink^^ target=another"]^^%=rsWorkgroup("Item") ^^[/a][/td]
[td colspan=28]^^=rsWOrkgroup("Desc") ^^[/td]
[td]^^=rsWorkgroup("price") ^^[/td]
[td colspan=43]^^=rsWorkgroup("Comments") ^^[/td][/tr]
^^
rsWorkgroup.movenext
wend ^^
[/table]
^^
rsWorkgroup.Close
Set rsWorkgroup = Nothing
dbConn.Close
Set dbConn = Nothing
^^
[/td]
[/tr]
[/table]
[/body]
[/html]