DT221/3 Internet Application Development Active Server Pages & Database Connection.

Slides:



Advertisements
Similar presentations
PHP SQL. Connection code:- mysql_connect("server", "username", "password"); Connect to the Database Server with the authorised user and password. Eg $connect.
Advertisements

Easy Application System (EASY) In an effort to streamline and expedite applications for the incentive programs offered by the Arizona Commerce Authority,
Hacking Web Servers April 15, 2010 MIS 4600 – MBA © Abdou Illia.
CIS 375—Web App Dev II ADO I. 2 Introduction ADO (________ Data Objects) is a Microsoft technology for accessing data in a database. ADO is automatically.
Mark Dixon Page 1 17 – Persistent data storage: relational databases and ADO.
Mark Dixon, SoCCE SOFT 131Page 1 24 – Web applications: Writing data to Databases using ASP.
Pennsylvania’s Protection From Abuse Database
Session 6 Server-side programming - ASP. An ASP page is an HTML page interspersed with server-side code. The.ASP extension instead of.HTM denotes server-side.
ASP Application Development Session 3. Topics Covered Using SQL Statements for: –Inserting a tuple –Deleting a tuple –Updating a tuple Using the RecordSet.
Flash Quiz Results Storing Flash Quiz Results in an Access Database.
INTRODUCTION The Group WEB BROWSER FOR RELATION Goals.
Design Aspects. User Type the URL address on the cell phone or web browser Not required to login.
1 ASP History/Components  Active Server History:  Introduced July 1996  Bundled with Internet Information Server (IIS) 3,0 March of 1997  ASP 2.0 introduced.
Introduction to Active Server Pages
4/8/99 C. Edward Chow Page 1 Active Server Page It is a server-side scripting environment for creating dynamic content. ASP are files with.asp extension,
Mark Dixon Page 1 20 – Modular Design in ASP. Mark Dixon Page 2 Session Aims & Objectives Aims –Highlight modular design techniques in ASP Objectives,
4/8/99 C. Edward Chow Page 1 Internet Services Manager Click Start | Programs | Administrative Tools | Internet Services Manager.
2/22/00J. Alberto Espinosa -- CMU/GSIA MIS Dynamic HTML Using Active Server Pages (ASP) Alberto Espinosa MIS
Prospective Student Login Current Process. go.carleton.edu/clearly.
Mark Dixon, SoCCE SOFT 131Page 1 19 – Web applications: Server-side code (ASP)
DT221/3 Internet Application Development Active Server Pages & Database Connection.
Michael Tucker DBA / Webmaster Forsyth County Public Library.
Lecture 3 – Data Storage with XML+AJAX and MySQL+socket.io
MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples.
Deleting and Updating Records in MySQL using PHP Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
1 Lecture 3 Web Technologies Part 2. 2 l HTML l XHTML l CSS l XML l JavaScript l VBSCRIPT DOM l DHTML l AJAX l E4X l WMLScript l SQL Web Technologies.
G053 - Lecture 17 Making Forms Work Mr C Johnston ICT Teacher
Interacting With Data Databases.
ActiveX Data Object (ADO) in JavaScript J.L.Wang, Yen-Cheng Chen Dept. of Infomation Management Ming-Chuan University Jan
Database 20/2/12 Connection. 
1 Tutorial 2 ABC Web site. Objective Learning web applications design Conducting assumed business logic online Connecting the Database with the web pages.
Server Side Programming ASP1 Server Side Programming Database Integration (cont.) Internet Systems Design.
Mark Dixon Page 1 23 – Web applications: Writing data to Databases using ASP.
Accessing MySQL with PHP IDIA 618 Fall 2014 Bridget M. Blodgett.
MySQL Databases & PHP Integration Using PHP to write data to, and retrieve data from, a MySQL database.
Putting it all together Dynamic Data Base Access Norman White Stern School of Business.
Lesson 18. CGI Setup Browser Server CGI Scripts/ Program Database Request Http reply.
Looking for simple php script Language: PHP Must be php>>>>> I can not use an other language Budget: $30.0 If more than $30.0 Please do not bid Login page.
Lecture Note 10: Simple Database Techniques. Introduction –Database System –Access, SQL Server and others. –Microsoft Access - Interacting with this databases.
Internet Programming ASP Sara Shahzad Dept. of Computer Science UOP.
Intro to DatabasesClass 4 SQL REVIEW To talk to the database, you have to use SQL SQL is used by many databases, not just MySQL. SQL stands for Structured.
How to Connect to Database ODBC (Open Database Connectivity) ADO (ActiveX Data Object) ASP Code To Connect to Database Recordset Object Navigating through.
Login to a Database (from a Webpage), Inserting data into a database from a form, getting data from database and display on Webpage Done by: Mashail Alsolamy.
Mark Dixon Page 1 21 – Web applications: Writing data to Databases using ASP.
GOAL User Interactive Web Interface Update Pages by Club Officers Two Level of Authentication.
Web Architecture Introduction
NMD202 Web Scripting Week5. What we will cover today PHP & MySQL Displaying Dynamic Pages Exercises Modifying Data PHP Exercises Assignment 1.
Mark Dixon, SoCCE SOFT 131Page 1 23 – Web applications: Databases & ASP.
ASP-12-1 Data Store Access Colorado Technical University IT420 Tim Peterson.
Server Side Programming ASP1 Server Side Programming.
Database Connectivity What is ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a Microsoft Active-X component.
2314 – Programming Language Concepts Introduction to ADO.NET.
Labtest.ASP Notes. INSERT STATUS INSERT STATUS
Chapter 5 Building Your Product Catalog database Objectives Create Database. Create Table. Connect to Database. Use ASP Script to add new products. Use.
Connecting to Online Resources from Off-Campus
PHP is a server scripting language, and a powerful tool for making dynamic and interactive Web pages. PHP is a widely-used, free, and efficient alternative.
Introduction to Dynamic Web Programming
An authorized user can make payments on your account by logging on with their own username and password. Click on the Authorized Users tab to add an authorized.
21 – Web applications: Server-side code (ASP)
Library Reserve System
PHP Overview PHP: Hypertext Preprocessor Server-Side Scripting
Step by step instructions to Add an Admin User in WordPress utilizing FTP Guided By: - WPGLOBALSUPPORTWPGLOBALSUPPORT.
Client-Side Validation with Javascript
Chapter 6 Displaying Your Products
Go to PC1.
Create New User in Database. First Connect the System.
Database Connectivity and Web Development
Introduction to Web programming
APPLYING FOR A FSA ID
ASP Database Operations
Presentation transcript:

DT221/3 Internet Application Development Active Server Pages & Database Connection

Example of ASP Database Connection A simple application example 1)Use ASP for HTML form 2)Login Check 3)Database Connection 4)Database Insertion, Update and Deletion

Example of ASP Database Connection User ManagementAction Process Insertion Form Update Form Deletion Conform Login Form Insertion Update Deletion

Example of ASP Database Connection-login.asp Login page User Name: Password:

Example of ASP Database Connection-check.asp(1) <% Dim user, password user = Request.Form("user").Item password = Request.Form("password").Item dim Conn, Rs, mySQL set Conn = Server.CreateObject("ADODB.Connection") ' conn objects set Rs = Server.CreateObject("ADODB.RecordSet")' Record Set Conn.Open ("Provider=sqloledb;Server=CIAN;Database=cliu;Uid=testuser;Password=;") Rs.ActiveConnection = Conn mySQL = "Select SecurityLevel From cliu.users Where UserName= '" & user & "' and Password = '" & password & "'" Rs.Open(mySQL)

Example of ASP Database Connection-check.asp(2) if not Rs.eof then if Rs("securityLevel")=12 then Session("level")=12 Conn.Close Set Conn = NOTHING Response.Redirect ("menu.asp") end if if Rs("securityLevel")=8 then Session("level")=8 Conn.Close Set Conn = NOTHING Response.Redirect("showuser.asp") end if if Rs("securityLevel")=1 then Session("level")=1 Conn.Close Set Conn = NOTHING Response.Redirect("welcome.asp") end if

Example of ASP Database Connection-check.asp(3) else Session("level")=-1 Conn.Close Set Conn = NOTHING Response.Redirect("login.asp") end if %>

Example of ASP Database Connection-check.asp(3) else Session("level")=-1 Conn.Close Set Conn = NOTHING Response.Redirect("login.asp") end if %>

Example of ASP Database Connection-adduser.asp …… Please enter the new user name: Please enter the new password: Please enter the first name: Please enter the second name: Please enter the security level:

Example of ASP Database Connection-addusertodb.asp <%Dim user, password, first, second, level user = Trim(Request.Form("user").Item) password = Trim(Request.Form("password").Item) first = Trim(Request.Form("first").Item) second = Trim(Request.Form("second").Item) level = Request.Form("level").Item dim Conn, Rs, mySQL set Conn = Server.CreateObject("ADODB.Connection") ' conn objects set Rs = Server.CreateObject("ADODB.RecordSet")' Record Set Conn.Open ("Provider=sqloledb;Server=CIAN;Database=cliu;Uid=testuser;Password=;") mySQL = "Insert into cliu.users values ( '" & user& "', '" & password & "', '" & first & "', '" & second &"', " & level & ")“ Conn.Execute(mySQL) Conn.Close Set Conn = NOTHING Response.Redirect("showuser.asp") %>

Example of ASP Database Connection-edit.asp …… ") dim Conn, Rs, user_id, i set Conn = Server.CreateObject("ADODB.Connection") ' conn objects set Rs = Server.CreateObject("ADODB.RecordSet")' Record Set Conn.Open ("Provider=sqloledb;Server=CIAN;Database=cliu;Uid=testuser;Password=;") Rs.ActiveConnection = Conn Rs.Open("Select * From cliu.users") While not Rs.eof Response.Write("user name = " &Rs("UserName").Value & " ") Response.Write(" edit ") Response.Write(" ") Rs.MoveNext Wend %>

Example of ASP Database Connection-edituser.asp(1) <%Dim userid userid = Int(Request.QueryString("id").Item) dim Conn, Rs, mySQL set Conn = Server.CreateObject("ADODB.Connection") ' conn objects set Rs = Server.CreateObject("ADODB.RecordSet")' Record Set Conn.Open ("Provider=sqloledb;Server=CIAN;Database=cliu;Uid=testuser;Password=;") Rs = Conn.Execute("cliu.selectuser " &userid) %> Select user to edit

Example of ASP Database Connection-edituser(2).asp //Client side javascript function check(){ test=true if (document.form1.user.value==""){ alert("Please enter the user name"); document.form1.user.focus(); test=false;} if (document.form1.password.value==""){ alert("Please enter the password"); document.form1.password.focus(); test=false;} if (document.form1.first.value==""){ alert("Please enter the user' first name"); document.form1.first.focus(); test=false;} if (document.form1.second.value==""){ alert("Please enter the user's second name"); document.form1.second.focus(); test=false;}

Example of ASP Database Connection-edituser(3).asp if (document.form1.level.value==""||(document.form1.level.value!=12&&docu ment.form1.level.value!=8&&document.form1.level.value!=1)){ alert("Please enter the correct level"); document.form1.user.focus(); test=false; } return test } >

Example of ASP Database Connection-edituser.asp(4) Please enter the new user name: " size="20"> Please enter the new password: " size="20"> Please enter the first name: " size="20"> Please enter the second name: " size="20"> Please enter the security level: " size="20">

Example of ASP Database Connection-editusertodb.asp <%Dim user, password, first, second, level userid = Int(Request.Form("userid").Item) user = Trim(Request.Form("user").Item) password = Trim(Request.Form("password").Item) first = Trim(Request.Form("first").Item) second = Trim(Request.Form("second").Item) level = Int(Request.Form("level").Item) dim Conn, Rs, mySQL set Conn = Server.CreateObject("ADODB.Connection") ' conn objects set Rs = Server.CreateObject("ADODB.RecordSet")' Record Set Conn.Open ("Provider=sqloledb;Server=CIAN;Database=cliu;Uid=testuser;Password=;") Conn.Execute("cliu.edituser "& userid &",'" & user& "', '" & password & "', '" & first & "', '" & second &"', " & level) Conn.Close Set Conn = NOTHING Response.Redirect("menu.asp") %>

Example of ASP Database Connection-deluser.asp(1) Database Connection function ConfirmDelete(s_User, s_ID) { var s_Dialog = "Are you sure you want to delete user '" + s_User + "'?"; if(confirm(s_Dialog)) { document.location.href = "deluserdb.asp?id=" + s_ID; } }// end function

Example of ASP Database Connection-deluser(2).asp ") dim Conn, Rs, user_id, i set Conn = Server.CreateObject("ADODB.Connection") ' conn objects set Rs = Server.CreateObject("ADODB.RecordSet")' Record Set Conn.Open ("Provider=sqloledb;Server=CIAN;Database=cliu;Uid=testuser;Password=;") Rs.ActiveConnection = Conn Rs.Open("Select * From cliu.users") While not Rs.eof Response.Write("user name = " &Rs("UserName").Value & " ") Response.Write(" del ") Response.Write(" ") Rs.MoveNext Wend %>

Example of ASP Database Connection-deluserdb.asp <% Dim userid userid = Int(Request.QueryString("id").Item) dim Conn, Rs, mySQL set Conn = Server.CreateObject("ADODB.Connection") ' conn objects set Rs = Server.CreateObject("ADODB.RecordSet")' Record Set Conn.Open ("Provider=sqloledb;Server=CIAN;Database=cliu;Uid=testuser;Password=;") Conn.Execute("cliu.deluser "& userid ) Conn.Close Set Conn = NOTHING Response.Redirect("menu.asp") %>