Basics of HTML

Download Report

Transcript Basics of HTML

ASP and Database Connectivity
Masters Project CS 490
Kevin Murphy
Creating an ASP Page
database connection
You do need:
o Visual Basic scripting knowledge
o a basic text editor
<% to begin the Vb Script
%> to begin the Vb Script
Kevin Murphy
Step 1: The variables
<%
Dim sql
Dim oRS
Dim oConn, sConnString
Kevin Murphy
Step 2: The connection type
Set oConn =
Server.CreateObject("ADODB.Connection")
Kevin Murphy
Step 3: The driver used
sConnString = "DRIVER={Microsoft Access
Driver (*.mdb)};" & _
"DBQ=" &
Server.MapPath("\murf\db\neiu.mdb") &
";"
Kevin Murphy
Step 4: Open the connection
oConn.Open(sConnString)
Kevin Murphy
Step 4: SQL select
sql = "select Course, Grade,
Semester, Year from Classes"
Kevin Murphy
Step 4: execute the
connection
Set oRS = oConn.Execute(sql)
%>
Kevin Murphy
Comments
n
Use the internet for resources, there are
many sites for examples.
n
Draw a plan of your database on paper
before you begin.
n
Make backups of pages prior to
changes.
n
Once a working example exists, use it
as a starting point for other pages.
Kevin Murphy