iNET Interactive - Online Advertising Agency
          
   Home    Authors    About    Login    Contact Us
   Search:   
Advanced Search     
  Articles

  ASP (26)
  ASP.NET (19)
  C and C++ (4)
  CFML (2)
  CGI and Perl (16)
  Flash (2)
  Java (7)
  JavaScript (28)
  PHP (92)
  MySQL (13)
  MSSQL (3)
  HTML (34)
  SEO (9)
  Visual Basic (12)
  CSS (13)
  SSI (5)
  XML (12)
  C# (14)

  Developer News

May 17, 2008
Learn HTML forms
About
 
May 16, 2008
Who Are Your Top Friends on Facebook?
About
 
May 15, 2008
Reader Question - Would you host your client's work on your website?
About
 
May 15, 2008
How to Create an Ajax Autocomplete Text Field: Part 6
WebReference.com
 
May 14, 2008
Poll: Are the browser safe colors still needed?
About
 
May 14, 2008
Google Doctype launched
About
 
Courtesy of moreover.com
 
Want to receive new articles via e-mail? Click here!
/Home /ASP

Step by step guide to a Database-Driven application 

  Views:    19416
  Votes:    11
by Romeo Marquez 12/13/03 Rating: 

Synopsis:

Here’s a four step tutorial about an application that can collect data, store it in a DB, modify it and delete it.
Pages: firstback2 3 4 forwardlast
The Article

Here’s the first part of the tutorial I’ll write about an application that can collect data,

store it in a DB, modify it and delete it.

 

First we’ll create all the prerequisites:

 

1.       Creating our workspace

First create a new folder anywhere you want in your HD. Open the IIS and then create

a Virtual Directory, name it anything you like and point it to the folder created previously.

 

2.       The database

For the sake of this tutorial we’ll use Access. It will work with SQL Server if you change the connection data.

 

Let’s create a Blank Database named example.mdb with the following tables:

 

USERS

DETAILS

ID (AutoNumber)

Name (text)

LastName (text)

Email (text)

Password (text)

 

ID_Detail

ID (Number)

Request (Text)

Date_Requested (Date/Time)

Comments (Memo)

 

Fill both tables with a few entries. Remember the ID field in the DETAILS table must exist in the USERS table.

 

3.       Set the connection stuff

We’ll store the connection information in a file named DBInfo.asp

Here’s the code:

<%

Dim strConnect

strconnect= "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:\YourFolder\example.mdb;

Persist Security Info=False"

%>

<!-- METADATA NAME="Microsoft ActiveX Data Objects 2.5 Library" TYPE="TypeLib"

UUID="{00000205-0000-0010-8000-00AA006D2EA4}" -->

 

Now we’re ready to first our first page, we’ll name it listing.asp

 

<% Option Explicit %>

<!-- #INCLUDE FILE="DBInfo.asp" -->

<HTML>

<HEAD><TITLE>Users listing</TITLE></HEAD>

<BODY>

<%

Dim objRS

Set objRS = Server.CreateObject ("ADODB.Recordset")

objRS.Open "Users", strConnect, adOpenForwardOnly, adLockReadOnly, adCmdTable

 

response.write  "<table width='400' border='1'><tr><td><b>User ID</b></td>" & _

                                                "<td><b>Full Name</b></td><td><b>Email</b></td></tr>"

While Not objRS.EOF

            Response.Write "<tr><td>"

            Response.Write objRS("ID") & "</td><td>" &objRS("Name") & " "&objRS("Lastname")& _

                                                            "</td><td>"&objRS("Email")&"</td></tr>"

            objRS.MoveNext

Wend

response.write "</table"

objRS.Close                   

Set objRS = Nothing           

%>

</BODY></HTML>

 

This code will generate a table with a row for every single record on our database!!!

In the second part of this series we will learn how to add users to this table!

 

Pages: firstback2 3 4 forwardlast

Similar/related articles:


 
  Sponsors