WebDB Frequently Asked Questions
What is WebDB?
A program. written in Visual Basic 6, that will quickly
create a group of ASP pages for learning purposes.
What files are created and what do they do?
See the ReadMe.txt file that the program creates for
details.
How do I create a group of ASP pages using WebDB?
Run the program. Type in the name of a table you want to
create - typically, it is something you want to keep up with like, books,
members, elephants, etc. Type in the number of fields you want for each record.
Change the name of the Image File Name, if you want to use an image. Then, type
in the names of the fields you want to use, and press the TAB key to move to the
next field. After you enter the field names, click the CREATE ASP FILES button.
How to I get it running on a Web Server?
Upload the files to a Web server that supports ASP pages.
Upload a blank Access database file named db.mdb to your Web server. Set
permissions on the db.mdb file to allow the Internet Guest Account to have full
write access. Point your browser to the XXXXX-Main.asp page (XXXXX is the name
of the table). Click the link "Add new XXXXX table to db.mdb" to create your
table. Then, click the "Edit XXXXXs" link. Then, click ADD to add records.
What if I get an error?
Be careful not to use field names that are key words in
VBScript like NAME, TIME, etc. Many people use naming conventions like bkTitle,
bkAuthor, etc. so that you will not inadvertently use a VBScript keyword. If you
get an error, try re-running WebDB and name your fields using a three character
prefix to each field name, such as eleName, eleTime, etc.
Also, if a user enters a quote or apostrophe in a field,
since the program does not write code to catch this error, you can get an error
related to the SQL statement not being properly formatted.
How can I learn the code?
The best way to understand the code that WebDB generates
is to:
- Download WebDB at the link below
- Unzip the WebDB.zip file
- Place WebDB.exe in a new folder on your desktop named
DOGS
- Run WebDB.exe
- Type in DOGS as the table name
- Type in 2 as the number of fields
- Type theName as the first field, press TAB key and type
theAge as the second field
- Click the CREATE ASP FILES button
- Open each file that begins with DOG- with Notepad and
print each page - 10 pages total
- Carefully read the ReadMe.txt file
- Lay the pages out on your desk (or on the floor) so you
can see the code for all the pages
- Copy all the files that begin with DOG- to a new folder
named DOGS on a Web Server that supports ASP pages
(in your A??\DOGS folder on our class Web server, or in your c:\inetpub\wwwroot\dogs
folder on your computer running IIS)
- Create a new Access database file named db.mdb and
place it in this same folder named DOGS
- Set permissions on the db.mdb file so that the Internet
Guest Account has full write permissions
(NOTE: on our class server, you will need to email me at my home email address
and I will be glad to set the permissions for you - be sure to include your
folder name (A12, A15, etc.) and the file name (in this case - db.mdb) OR, you
can place your files in your A?? folder and I've already placed a file name
db.mdb and set the permissions for you, OR, if you are running it on your
local computer running IIS, you may need to set it yourself by right clicking
the db.mdb file, click PROPERTIES, click on the SECURITY tab, click on the
INTERNET GUEST ACCOUNT, then click a check to ALLOW FULL CONTROL, then click
OK)
- Open your browser and type in the URL to your new DOGS
folder
(http://www.halharris.com/282/ftp/a??/dogs on our class web server or http://localhost/dogs
on your computer running IIS)
- Click on the DOG-Main.asp page
(NOTE: if you are viewing it on your computer running IIS, you will need to
have directory browsing turned on or type in the URL to this page - http://localhost/dogs/DOG-Main.asp)
- Click on the 3rd link on the page, the one that says
"Add new Dog table to db.mdb" link
- Click the BACK button to return to your DOG-Main.asp
page
- Click on the "Edit Dogs" link
- Click on the "Add Dog" link and enter several sample
records, then return to the Main.asp page
- Click on the "Edit Dogs" link again
- Move your mouse over each of the links with dog names.
While over each link, look at the status bar at the bottom of the browser
window and notice the exact URL as you move the mouse over different records.
Note the ID number changing.
- Click on one of the links and change one of the dog
names and click the SAVE button
- Continue to play with the example and look at the code
on your printouts, carefully reading the comments for each block of code
- To see the SQL statements being executed, open the page
(DOG-EditUpdate.asp or DOG-AddUpdate.asp) on your computer, with notepad and
REM out (place an apostrophe at the beginning of the line of code) the
statement that executes the SQL statement (for example,
conn.Execute sql, Recordsaffected
or conn.Execute "Delete FROM Dog Where
Dog.[id]=" & notoedit, Recordsaffected), the
response.redirect statement (for example,
response.redirect("Dog-PickList.asp")), and any
other line of code that references fields from your recordset (for example,
rs.Fields("theName").
Add a line of code below that statement that prints the SQL statement out to
the browser - response.write "The SQL
statement is=>" & SQL. Save your file and copy it to
the server. Then, return to the browser and view the pages. With this change,
you will see the SQL statement in the browser instead of having the record
saved or added.
Where can I download WebDB?
Click this download link and unzip
the file.