Mssql asp l.jpg
Advertisement
This presentation is the property of its rightful owner.
1 / 18

MSSQL & ASP PowerPoint PPT Presentation

MSSQL & ASP MSSQL & ASP Client-Server Relationship HTML Basics Scripting Basics Examples 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

Download Presentation

MSSQL & ASP

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


Mssql asp l.jpg

MSSQL&ASP


Mssql asp2 l.jpg

MSSQL & ASP

  • Client-Server Relationship

  • HTML Basics

  • Scripting Basics

  • Examples


Client server relationship l.jpg

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


Client server relationship4 l.jpg

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)


Html basics l.jpg

HTML Basics

  • HTML performs two essential tasks

    • Displays data

    • Submits data to be process


Html basics6 l.jpg

HTML Basics

  • Tags

    • HTML uses tags to format data

    • Tag Format:

      <command attribute1=“” attribute2=“”…>

      Some text here (optional)

      </command>

    • Save in a text editor (or web editor like Dreamweaver) and open with IE, Netscape, etc.


Html basics7 l.jpg

HTML Basics

  • Example:

    <html>

    <body>

    <p>This is a paragraph.</p>

    <p>This is a paragraph.</p>

    <p>This is a paragraph.</p>

    <p>Paragraph elements are defined by the p tag.</p>

    </body>

    </html>


Html basics8 l.jpg

HTML Basics

  • Common tags

    • <html> - starts all documents

    • <body> - all text is placed here

    • <a> - links to other pages. Example:

      <a href="http://www.w3schools.com/">This is a Link</a>

    • <table>,<td>,<tr> - formats data in table form

    • <form> - allow the user to enter information (explained in next slide)

    • Other tags - http://www.w3schools.com/html/html_reference.asp


Html basics9 l.jpg

HTML Basics

  • Forms - A form is defined with <form> tag

  • Structure:

    <form>

    <input>

    <input>

    </form>


Html basics10 l.jpg

HTML Basics

  • Form Example:

    <form name="input" action="html_form_action.asp" method=“post">

    Username:

    <input type="text" name="user">

    <input type="submit" value="Submit">

    </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


Vb script basics l.jpg

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)


Vb script basics12 l.jpg

VB Script Basics

  • Example Script:

    (saved as “example1.asp”)

    <html>

    <body>

    <%

    dim name

    name="John Harney"

    Response.write("My name is:<b>" & name & “</b>”)

    %>

    </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


Vb script basics13 l.jpg

VB Script Basics

  • Example Form:

    (saved as “example2.html”)

    <html>

    <body>

    <form name="input" action="example2.asp" method="post">

    Grade:

    <input type="text" SIZE="3" name="grade">

    <input type="submit" value="Submit">

    </form>

    </body>

    </html>

    • Form is “posted” to “example2.asp” with the text information “grade” when the user clicks submit


Vb script basics14 l.jpg

VB Script Basics

  • Example Form:

    (saved as “example2.asp”)

    <html>

    <body>

    <%

    Dim grade

    entry = Request.Form("grade")

    If entry > 90 Then

    Response.write "<h3>You have an A</h3>"

    elseif entry > 80 Then

    Response.write "<h3>You have a B</h3>"

    elseif entry > 70 Then

    Response.wrtie "<h3>You have a C</h3>"

    else

    Response.write "<h3>You have an F</h3>"

    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


Slide15 l.jpg

ASP

  • ASP

    • Combines html and scripting with a database

    • Accesses the database and uses the information in data processing


Slide16 l.jpg

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:

    <%

    sqlText = “select * from database”

    Adocon.Open sqlText

    %>


Slide17 l.jpg

ASP

  • ASP Example – Sporting Goods Retailer

    • Contains the following 3 tables:

      • Product (prodID,name,quantity,cost)

      • Customer (custID,name,cardNo)

      • Cp (custID,prodID)


References l.jpg

References

  • www.w3schools.com – HTML,VB,ASP

  • www.learnasp.com – ASP validation and cookies

  • www.uncg.edu/mat/DatabaseProjects - Mathematical Science Database Page

  • Email: [email protected]

  • Office: Bryan 384 (W F 1-5)


  • Login