Download presentation
Presentation is loading. Please wait.
Published byDebra Davidson Modified over 9 years ago
1
MSSQL & ASP
2
Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples
3
Client-Server Relationship Client – user of an application –Sends requests to the server for a specific tasks (process data, obtain data, etc) –Uses HTML to tell web browser how to display data
4
Client-Server Relationship Server – more specifically, ASP (Active Server Pages) –Receives requests from the client to perform a certain task –Processes data and sends results back to the client –Uses scripting languages to process data (VBScript,PHP,JavaScript)
5
HTML Basics HTML performs two essential tasks 1.Displays data 2.Submits data to be process
6
HTML Basics Tags –HTML uses tags to format data –Tag Format: Some text here (optional) </command> –Save in a text editor (or web editor like Dreamweaver) and open with IE, Netscape, etc.
7
HTML Basics Example:<html><body> This is a paragraph. This is a paragraph. Paragraph elements are defined by the p tag. Paragraph elements are defined by the p tag. </body></html>
8
HTML Basics Common tags – - starts all documents – - all text is placed here – - links to other pages. Example: This is a Link This is a Link –,, - formats data in table form – - allow the user to enter information (explained in next slide) –Other tags - http://www.w3schools.com/html/html_reference.asp
9
HTML Basics Forms - A form is defined with tag Structure:<form> </form>
10
HTML Basics Form Example: Username: </form> –When user selects the “submit” button, the information in the form is submitted to the page “html_form_action.asp”. Other form elements: http://www.w3schools.com/html/html_forms.asp
11
VB Script Basics VB Scripts –Lightweight version of Visual Basic programming language –Can be placed anywhere in html code –Run by server and sent back to client –<% denotes beginning of the script –%> denotes end of script –Files with.asp extension will hold scripts (usually)
12
VB Script Basics Example Script: (saved as “example1.asp”) <html><body><% dim name name="John Harney" Response.write("My name is: " & name & “ ”) %></body></html> –Dim – dimensions a variable (can be any type) –Response.write – writes html content to the html page –Response Examples: –http://www.w3schools.com/asp/asp_ref _response.asp
13
VB Script Basics Example Form: (saved as “example2.html”) <html><body> Grade: </form></body></html> –Form is “posted” to “example2.asp” with the text information “grade” when the user clicks submit
14
VB Script Basics Example Form: (saved as “example2.asp”) <html><body><% Dim grade entry = Request.Form("grade") If entry > 90 Then Response.write " You have an A " Response.write " You have an A " elseif entry > 80 Then elseif entry > 80 Then Response.write " You have a B " Response.write " You have a B " elseif entry > 70 Then elseif entry > 70 Then Response.wrtie " You have a C " Response.wrtie " You have a C " else else Response.write " You have an F " Response.write " You have an F " End If %></body></html> –Request.Form is the “posted” information from the form in “example2.html” –“grade” is the name of the text that was submitted
15
ASP ASP –Combines html and scripting with a database –Accesses the database and uses the information in data processing
16
ASP ASP – commands for accessing database <% set adocon = server.CreateObject("ADODB.Connection") set adorec = server.CreateObject("ADODB.recordset") adocon.Open("dsn=cscmssql1; uid=username; pwd=password;") adorec.ActiveConnection=adocon%> After connection is made, enter the sql command and use it: After connection is made, enter the sql command and use it:<% sqlText = “select * from database” Adocon.Open sqlText %>
17
ASP ASP Example – Sporting Goods Retailer –Contains the following 3 tables: Product (prodID,name,quantity,cost) Customer (custID,name,cardNo) Cp (custID,prodID)
18
References www.w3schools.comwww.w3schools.com – HTML,VB,ASP www.w3schools.com www.learnasp.comwww.learnasp.com – ASP validation and cookies www.learnasp.com www.uncg.edu/mat/DatabaseProjectswww.uncg.edu/mat/DatabaseProjects - Mathematical Science Database Page www.uncg.edu/mat/DatabaseProjects Email: jfharney@uncg.edu jfharney@uncg.edu Office: Bryan 384 (W F 1-5)
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.