mssql & asp. client-server relationship client-server relationship html basics html basics...
TRANSCRIPT
![Page 1: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/1.jpg)
MSSQLMSSQL&&
ASPASP
![Page 2: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/2.jpg)
MSSQL & ASPMSSQL & ASP
• Client-Server RelationshipClient-Server Relationship• HTML BasicsHTML Basics• Scripting BasicsScripting Basics• ExamplesExamples
![Page 3: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/3.jpg)
Client-Server RelationshipClient-Server Relationship
Client – user of an applicationClient – user of an application– Sends requests to the server for a specific Sends requests to the server for a specific
tasks (process data, obtain data, etc)tasks (process data, obtain data, etc)– Uses HTML to tell web browser how to display Uses HTML to tell web browser how to display
datadata
![Page 4: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/4.jpg)
Client-Server RelationshipClient-Server Relationship
Server – more specifically, ASP (Active Server – more specifically, ASP (Active Server Pages)Server Pages)– Receives requests from the client to perform a Receives requests from the client to perform a
certain taskcertain task– Processes data and sends results back to the Processes data and sends results back to the
clientclient– Uses scripting languages to process data Uses scripting languages to process data
(VBScript,PHP,JavaScript)(VBScript,PHP,JavaScript)
![Page 5: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/5.jpg)
HTML BasicsHTML Basics
HTML performs two essential tasksHTML performs two essential tasks1.1. Displays dataDisplays data
2.2. Submits data to be process Submits data to be process
![Page 6: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/6.jpg)
HTML BasicsHTML Basics
TagsTags– HTML uses tags to format dataHTML uses tags to format data– Tag Format:Tag Format:<command attribute1=“” attribute2=“”…><command attribute1=“” attribute2=“”…>
Some text here (optional)Some text here (optional)
</command></command>
– Save in a text editor (or web editor like Save in a text editor (or web editor like Dreamweaver) and open with IE, Netscape, Dreamweaver) and open with IE, Netscape, etc.etc.
![Page 7: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/7.jpg)
HTML BasicsHTML Basics
Example:Example:<html><html>
<body><body>
<p>This is a paragraph.</p><p>This is a paragraph.</p>
<p>This is a paragraph.</p><p>This is a paragraph.</p>
<p>This is a paragraph.</p><p>This is a paragraph.</p>
<p>Paragraph elements are defined <p>Paragraph elements are defined by the p tag.</p> by the p tag.</p>
</body></body>
</html></html>
![Page 8: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/8.jpg)
HTML BasicsHTML Basics
Common tagsCommon tags– <html> - starts all documents<html> - starts all documents– <body> - all text is placed here<body> - all text is placed here– <a> - links to other pages. Example:<a> - links to other pages. Example:<a href="http://www.w3schools.com/">This is a Link</a><a href="http://www.w3schools.com/">This is a Link</a>
– <table>,<td>,<tr> - formats data in table form<table>,<td>,<tr> - formats data in table form– <form> - allow the user to enter information (explained in next <form> - allow the user to enter information (explained in next
slide)slide)– Other tags - http://www.w3schools.com/html/html_reference.aspOther tags - http://www.w3schools.com/html/html_reference.asp
![Page 9: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/9.jpg)
HTML BasicsHTML Basics
Forms - A form is defined with <form> tagForms - A form is defined with <form> tag
Structure:Structure:<form> <form>
<input> <input>
<input><input>
</form></form>
![Page 10: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/10.jpg)
HTML BasicsHTML Basics
Form Example:Form Example:<form name="input" <form name="input"
action="html_form_action.asp" action="html_form_action.asp" method=“post"> method=“post">
Username: Username:
<input type="text" name="user"> <input type="text" name="user">
<input type="submit" value="Submit"> <input type="submit" value="Submit">
</form> </form>
– When user selects the “submit” When user selects the “submit” button, the information in the form button, the information in the form is submitted to the page is submitted to the page “html_form_action.asp”.“html_form_action.asp”.
Other form elements:Other form elements:http://www.w3schools.com/html/html_forms.asphttp://www.w3schools.com/html/html_forms.asp
![Page 11: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/11.jpg)
VB Script BasicsVB Script Basics
VB ScriptsVB Scripts– Lightweight version of Visual Basic Lightweight version of Visual Basic
programming languageprogramming language– Can be placed anywhere in html codeCan be placed anywhere in html code– Run by server and sent back to clientRun by server and sent back to client– <% denotes beginning of the script<% denotes beginning of the script– %> denotes end of script%> denotes end of script– Files with .asp extension will hold scripts Files with .asp extension will hold scripts
(usually) (usually)
![Page 12: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/12.jpg)
VB Script BasicsVB Script Basics
Example Script:Example Script:(saved as “example1.asp”)(saved as “example1.asp”)<html><html><body><body><%<%dim namedim namename="John Harney"name="John Harney"Response.write("My name is:<b>" & name & “</b>”)Response.write("My name is:<b>" & name & “</b>”)%>%></body></body></html></html>
– Dim – dimensions a variable (can Dim – dimensions a variable (can be any type)be any type)
– Response.write – writes Response.write – writes html content to the html pagehtml content to the html page– Response Examples:Response Examples:– http://www.w3schools.com/asp/http://www.w3schools.com/asp/
asp_ref_response.aspasp_ref_response.asp
![Page 13: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/13.jpg)
VB Script BasicsVB Script Basics
Example Form:Example Form:(saved as (saved as
“example2.html”)“example2.html”)<html><html><body><body><form name="input" action="example2.asp" <form name="input" action="example2.asp"
method="post">method="post">Grade: Grade: <input type="text" SIZE="3" name="grade"><input type="text" SIZE="3" name="grade"><input type="submit" value="Submit"><input type="submit" value="Submit"></form></form></body></body></html></html>
– Form is “posted” to Form is “posted” to “example2.asp” with the text “example2.asp” with the text information “grade” when the user information “grade” when the user clicks submitclicks submit
![Page 14: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/14.jpg)
VB Script BasicsVB Script BasicsExample Form:Example Form:
(saved as “example2.asp”)(saved as “example2.asp”)<html><html><body><body><%<%Dim gradeDim gradeentry = Request.Form("grade")entry = Request.Form("grade")If entry > 90 ThenIf entry > 90 Then Response.write "<h3>You have an A</h3>"Response.write "<h3>You have an A</h3>" elseif entry > 80 Thenelseif entry > 80 Then Response.write "<h3>You have a B</h3>"Response.write "<h3>You have a B</h3>" elseif entry > 70 Thenelseif entry > 70 Then Response.wrtie "<h3>You have a C</h3>"Response.wrtie "<h3>You have a C</h3>" elseelse Response.write "<h3>You have an F</h3>"Response.write "<h3>You have an F</h3>"End IfEnd If%>%></body></body></html></html>
– Request.Form is the “posted” Request.Form is the “posted” information from the form in information from the form in “example2.html”“example2.html”
– ““grade” is the name of the text that was grade” is the name of the text that was submittedsubmitted
![Page 15: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/15.jpg)
ASPASP
ASP ASP – Combines html and scripting with a databaseCombines html and scripting with a database– Accesses the database and uses the Accesses the database and uses the
information in data processinginformation in data processing
![Page 16: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/16.jpg)
ASPASP
ASP – commands for accessing databaseASP – commands for accessing database<%<%set adocon = server.CreateObject("ADODB.Connection") set adocon = server.CreateObject("ADODB.Connection") set adorec = server.CreateObject("ADODB.recordset") set adorec = server.CreateObject("ADODB.recordset") adocon.Open("dsn=cscmssql1; uid=username; pwd=password;") adocon.Open("dsn=cscmssql1; uid=username; pwd=password;") adorec.ActiveConnection=adoconadorec.ActiveConnection=adocon%>%>
After connection is made, enter the sql After connection is made, enter the sql command and use it:command and use it:<%<%sqlText = “select * from database” sqlText = “select * from database” Adocon.Open sqlTextAdocon.Open sqlText%>%>
![Page 17: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/17.jpg)
ASPASP
ASP Example – Sporting Goods RetailerASP Example – Sporting Goods Retailer– Contains the following 3 tables:Contains the following 3 tables:
Product (prodID,name,quantity,cost)Product (prodID,name,quantity,cost)Customer (custID,name,cardNo)Customer (custID,name,cardNo)Cp (custID,prodID)Cp (custID,prodID)
![Page 18: MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples](https://reader036.vdocument.in/reader036/viewer/2022082411/56649e155503460f94afeffe/html5/thumbnails/18.jpg)
ReferencesReferences
www.w3schools.comwww.w3schools.com – HTML,VB,ASP – HTML,VB,ASP
www.learnasp.comwww.learnasp.com – ASP validation and – ASP validation and cookiescookies
www.uncg.edu/mat/DatabaseProjectswww.uncg.edu/mat/DatabaseProjects - - Mathematical Science Database PageMathematical Science Database Page
Email: Email: [email protected]@uncg.edu
Office: Bryan 384 (W F 1-5)Office: Bryan 384 (W F 1-5)