ASP.NET Presented by Pan Gao. ASP.NET Next generation of ASP Next generation of ASP Program Language to build web application Program Language to build.

Slides:



Advertisements
Similar presentations
Data Base. Objective Become familiar with database terminology. Create a project to display data for a single database table. Use a DataGrid control.
Advertisements

1/8 AND, OR and NOT b How many boys? b How many girls? b How many blue? b How many red?
Chapter 10 Database Applications Copyright © 2011 by The McGraw-Hill Companies, Inc. All Rights Reserved. McGraw-Hill.
ASP.NET 2.0. What is ASP.NET is a server-side scripting language developed by Microsoft is the next generation of ASP (Active Server Pages), completely.
Integrating Access with the Web and with Other Programs.
Chapter 12: ADO.NET and ASP.NET Programming with Microsoft Visual Basic.NET, Second Edition.
Using ADO.NET Chapter Microsoft Visual Basic.NET: Reloaded 1.
ASP.NET Database Connectivity I. 2 © UW Business School, University of Washington 2004 Outline Database Concepts SQL ASP.NET Database Connectivity.
VB.NET Database Tools ISYS 573. Microsoft Universal Data Access ODBC: Open Database Connectivity –A driver manager –Used for relational databases OLE.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
1 Introduction to OBIEE: Learning to Access, Navigate, and Find Data in the SWIFT Data Warehouse Lesson 8: Printing and Exporting an OBIEE Analysis This.
Chapter 12 Database Connectivity with ASP.NET JavaScript, Third Edition.
Figure 1. Hit analysis in 2002 of database-driven web applications Hits by Category in 2002 N = 73,873 Results Reporting 27% GME 26% Research 20% Bed Availability.
Some Basic Database Terminology
Tutorial: Introduction to ASP.NET Internet Technologies and Web Application 4 th February 2010.
MSSQL & ASP. Client-Server Relationship Client-Server Relationship HTML Basics HTML Basics Scripting Basics Scripting Basics Examples Examples.
ASP.NET Part 3 Instructor: Charles Moen CSCI/CINF 4230.
1 Presented by Bikash Shrestha. 2 What is ASP.NET or ASP+? ASP.NET/ASP+ is a programming framework built on the common language runtime that can be used.
M Dixon 1 Web-Application Development Workshop. M Dixon 2 Session Aims & Objectives Aims –to introduce the main concepts involved in creating web-applications.
ASP.NET Part 4 Instructor: Charles Moen CSCI/CINF 4230.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
ASP.Net Web Applications. Characteristics of a typical data driven web application Web Server HTML Graphics Active-X Java Applets HTTP Request ADO / JDBC.
MSIS 5133 Advanced MIS - E-Commerce Spring 2003 Lecture 4: DotNet Technologies - Part 4 Using Controls with Databases Dr. Rathindra Sarathy.
Chapter 71 Building Data-Driven ASP.NET Applications Introduction to ASP.NET By Kathleen Kalata.
Creating Custom Controls with User Controls. Including Standard Content with User Controls Global Super Company Global Super Company We mean business!
1 ASP.NET ASP.NET Rina Zviel-Girshin Lecture 4. 2 Overview Data Binding Data Providers Data Connection Data Manipulations.
CIS 451: Using ASP.NET Objects with SQL Dr. Ralph D. Westfall February, 2009.
Needs for Accessing Database To make your web site more dynamic and maintainable, you can display information on your web pages that are retrieved from.
Ventsislav Popov Crossroad Ltd.. 1. ASP.NET Data Source Controls  SqlDataSource  EntityDataSource  ObjectDataSource 2. Entity Data Model and ADO.NET.
ASP.NET Event Handlers Database -> Browser ->Shopping Basket Validators.
CIS 375—Web App Dev II ASP.NET 7 Binding (based on w3schools.com— also see MSDN.NET developmentMSDN.NET development.
ASP.NET - accessing the database - datareader vs dataset - datagrid vs datalist - brief look at web matrix.
Caching Chapter 12. Caching For high-performance apps Caching: storing frequently-used items in memory –Accessed more quickly Cached Web Form bypasses:
1 Chapter 12 – Web Applications 12.1 Programming for the Web, Part I 12.2 Programming for the Web, Part II 12.3 Using Databases in Web Programs.
ASP.NET Database Connection. ASP.NET Framework The ASP.NET framework includes the ADO.NET data access technology for working with databases and other.
Action button “search” will query the jobs table once clicked.
June 23, 2001Database Creation Review and Exercises1 Database Creation Review 10: :30 Team Building Exercise ……………………….. John 10: :30 Database.
Mark Dixon Page 1 Web-Application Development Workshop.
1 UCN Technology: Computer Science: Autumn 2012 ADO.NET 2.0 Architecture DataReader DataSet Connection factory Config file.
CIS 375—Web App Dev II ASP.NET 8 More Binding. 2 The Repeater ControlThe Repeater Control 1 The Repeater control is used to display a repeated list of.
1.Net programmingADO.NETNOEA / PQC ADO.NET Architecture Connection factory Config file DataReader DataSet DataGrid Autogeneration of SQL.
Databases,Tables and Forms Access Text by Grauer Chapters 1 & 2.
M Dixon 1 Web-Application Development Workshop. M Dixon 2 Session Aims & Objectives Aims –to introduce the main concepts involved in creating web-applications.
TRAINING SESSIONS.NET Controls.  Standard Controls  Label  Textbox  Checkbox  Button, Image Button, Image control  Radio Button  Literal  Hyperlink.
Introduction to ADO.Net and VS Database Tools and Data Binding ISYS 350.
Ventsislav Popov Crossroad Ltd.. 1. ASP.NET Data Source Controls  SqlDataSource  EntityDataSource  ObjectDataSource 2. Entity Data Model and ADO.NET.
ASP.Net, Web Forms and Web Controls 1 Outline Session Tracking Cookies Session Tracking with HttpSessionState.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
CIS 375—Web App Dev II ASP.NET 9 Database. 2 ADO.NET What is ADO.NET? ADO.NET is a part of the.NET Framework ADO.NET consists of a set of classes used.
ASP.NET Binding and an Introduction to Database Queries Please use speaker notes for additional information!
BlackBerry Applications using Microsoft Visual Studio and Database Handling.
Selenium January Selenium course content  Introduction (Session-1)Session-  Automation  What is automation testing  When to go for automation.
Menus Menus provide groups of related commands for windows applications Menu, menu items, submenus A menu item that contains a submenu is considered to.
Databases and ADO.NET Programming Right from the Start with Visual Basic.NET 1/e 11.
1 Database Design and Development: A Visual Approach © 2006 Prentice Hall Chapter 12 DATABASE DESIGN AND DEVELOPMENT: A VISUAL APPROACH Chapter 12 Accessing.
Web Page-Chapter 6 Forms. Inserting a Form  Display the Insert bar  Click the arrow to the right of the display category on the Insert bar and then.
CIS 375—Web App Dev II ASP.NET 4 Server Controls.
1 Database Programming with ADO.NET Kashef Mughal.
January 27, 2001ASP Basics1 Active Server Pages (ASP) Basics The client/server model Objects Forms Active Server Pages VBScript Lab and Homework.
CIS 375—Web App Dev II ASP.NET 5 Events. 2 The Page_Load Event The Page_Load event is triggered when a page loads. [Example]Example Sub Page_Load lbl1.Text="The.
Inserting Hyperlinks  Purpose : Enables viewers to click the link and move directly to a slide  Directions : Make one link on slide one to move to each.
Northern Europe Label the following countries on the next page, using the color each countries is labeled in, then add capitals to each country using a.
ASP.NET Part II Dr. Awad Khalil Computer Science Department AUC.
Databases Computer Technology. First Record Last Record New Record Previous Record Current Record Next Record Working with Microsoft Access (Database)
Accessing Databases using Ado.net
Query Methods Where Clauses Start ….
Unit 4: The Server Tier (18 Hrs
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Searching Your Database
To insert a hyperlink ( a web page address, URL) using text
Presentation transcript:

ASP.NET Presented by Pan Gao

ASP.NET Next generation of ASP Next generation of ASP Program Language to build web application Program Language to build web application Part of Microsoft.Net Platform Part of Microsoft.Net Platform ASP.net pages have a new file extension,.aspx ASP.net pages have a new file extension,.aspx Better Language support Better Language support Has a large set of new controls Has a large set of new controls Even – driven programming Even – driven programming XML based programming XML based programming

ASP.Net Key elements 1. Text Box Control 2. Radio Button List 3. Check box control 4. Form and Buttons 5. Event Control 6. HyperLink Control 7. Array 8. Binding 9. Hast Table 10. Data Set 11. Database Connection and Displaying

Define Text Boxes Control

Define Radio Button List Control Red Red Blue Blue Green Green

asp:CheckBox Control Click to Submit Click to Submit Submitted Submitted Sub CheckedBox (Src As Object, Args As EventArgs) MyCheckBox.Text = "Submitted" End Sub

Forms and Buttons Sub submit(Source As Object, e As EventArgs) button1.Text="You clicked me!" End Sub Sub submit(Source As Object, e As EventArgs) button1.Text="You clicked me!" End Sub

ASP.NET Event Control Sub Page_Load Sub Page_Load lbl1.Text="The date and time is " & now() lbl1.Text="The date and time is " & now() End Sub End Sub The date and time is :36:21 The date and time is :36:21

ASP.NET HyperLink Control Here is a text link to the Home Page Here is a text link to the Home Page Here is a text link to the Home Page Here is a text link to the Home Page

Array in ASP.NET Sub Page_Load If Not IsPostBack Then Dim ColorList = New ArrayList ColorList.Add("Red") ColorList.Add("Green") ColorList.Add("Blue") ColorList.TrimToSize() ColorList.Sort() End If End Sub Blue Green red

Binding to an ArrayList Dim ColorList As New ArrayList ColorList.Add("Red") ColorList.Add("Green") ColorList.Add("Blue") ColorList.TrimToSize() ColorList.Sort() RadioButtons.DataSource = ColorList RadioButtons.DataBind Dim ColorList As New ArrayList ColorList.Add("Red") ColorList.Add("Green") ColorList.Add("Blue") ColorList.TrimToSize() ColorList.Sort() RadioButtons.DataSource = ColorList RadioButtons.DataBind

ASP.NET Hash Table sub Page_Load sub Page_Load if Not Page.IsPostBack then if Not Page.IsPostBack then dim mycountries=New Hashtable dim mycountries=New Hashtable mycountries.Add("N","Norway") mycountries.Add("S","Sweden") mycountries.Add("F","France") mycountries.Add("I","Italy") rb.DataSource=mycountries rb.DataValueField="Key" rb.DataTextField="Value" rb.DataBind() mycountries.Add("N","Norway") mycountries.Add("S","Sweden") mycountries.Add("F","France") mycountries.Add("I","Italy") rb.DataSource=mycountries rb.DataValueField="Key" rb.DataTextField="Value" rb.DataBind() end if end if end sub end sub sub displayMessage(s as Object,e As EventArgs) sub displayMessage(s as Object,e As EventArgs) lbl1.text="Your favorite country is: " & rb.SelectedItem.Text lbl1.text="Your favorite country is: " & rb.SelectedItem.Text end sub end sub

France France Sweden Sweden Italy Italy Norway Norway Your favorite country is: Italy France France Sweden Sweden Italy Italy Norway Norway Your favorite country is: Norway

XML Files and DataSet Norway Norway N N Sweden Sweden S S France France F F Italy Italy I I

Dataset Sub Page_Load If Not IsPostBack Then Dim MenuItems = New DataSet MenuItems.ReadXml(MapPath(“test.xml")) End If End Sub Sub Page_Load If Not IsPostBack Then Dim MenuItems = New DataSet MenuItems.ReadXml(MapPath(“test.xml")) End If End Sub

Binding to control sub Page_Load if Not Page.IsPostBack then dim mycountries=New DataSet mycountries.ReadXml(MapPath("countries.xml")) rb.DataSource=mycountries rb.DataValueField="value" rb.DataTextField="text" rb.DataBind() end if end sub sub displayMessage(s as Object,e As EventArgs) lbl1.text="Your favorite country is: " & rb.SelectedItem.Text end sub sub Page_Load if Not Page.IsPostBack then dim mycountries=New DataSet mycountries.ReadXml(MapPath("countries.xml")) rb.DataSource=mycountries rb.DataValueField="value" rb.DataTextField="text" rb.DataBind() end if end sub sub displayMessage(s as Object,e As EventArgs) lbl1.text="Your favorite country is: " & rb.SelectedItem.Text end sub

Binding to a control

Displaying France Sweden Italy Norway Your Favorite country is: Norway

ASP.NET Database Connection OleDbConnection - for connecting to a database OleDbConnection - for connecting to a database OleDbCommand - for issuing SQL queries against database tables OleDbCommand - for issuing SQL queries against database tables OleDbDataReader - for access to the datasets retrieved from queries OleDbDataReader - for access to the datasets retrieved from queries

Opening a Database Connection Sub Page_Load 'Open database connection Sub Page_Load 'Open database connection Dim DBConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; Dim DBConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=d:\Databases\eCommerce.mdb") DBConnection.Open() End Sub DATA SOURCE=d:\Databases\eCommerce.mdb") DBConnection.Open() End Sub

Creating a Database Command Sub Page_Load 'Open database connection Sub Page_Load 'Open database connection Dim DBConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=d:\Databases\eCommerce.mdb") DBConnection.Open() 'Create database command and issue through connection Dim DBConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=d:\Databases\eCommerce.mdb") DBConnection.Open() 'Create database command and issue through connection Dim SQLString = "SELECT * FROM Products" Dim DBCommand = New OleDbCommand(SQLString, DBConnection) End Sub Dim SQLString = "SELECT * FROM Products" Dim DBCommand = New OleDbCommand(SQLString, DBConnection) End Sub

Creating a DataReader Sub Page_Load 'Open database connection Dim DBConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=d:\Databases\eCommerce.mdb") DBConnection.Open() 'Create database command and issue through connection Dim SQLString = "SELECT * FROM Products" Dim DBCommand = New OleDbCommand(SQLString, DBConnection) 'Return dataset to data reader Dim DBReader = DBCommand.ExecuteReader() End Sub Sub Page_Load 'Open database connection Dim DBConnection = New OleDbConnection("PROVIDER=Microsoft.Jet.OLEDB.4.0; DATA SOURCE=d:\Databases\eCommerce.mdb") DBConnection.Open() 'Create database command and issue through connection Dim SQLString = "SELECT * FROM Products" Dim DBCommand = New OleDbCommand(SQLString, DBConnection) 'Return dataset to data reader Dim DBReader = DBCommand.ExecuteReader() End Sub

Display Database Records sub Page_Load dim dbconn,sql,dbcomm,dbread sub Page_Load dim dbconn,sql,dbcomm,dbread dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("northwind.mdb")) dbconn.Open() dbconn=New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;data source=" & server.mappath("northwind.mdb")) dbconn.Open() sql="SELECT * FROM customers" dbcomm=New OleDbCommand(sql,dbconn) dbread=dbcomm.ExecuteReader() sql="SELECT * FROM customers" dbcomm=New OleDbCommand(sql,dbconn) dbread=dbcomm.ExecuteReader() customers.DataSource=dbread customers.DataBind() customers.DataSource=dbread customers.DataBind() dbread.Close() dbconn.Close() end sub dbread.Close() dbconn.Close() end sub

Display Database Companyname Contactname Address City Companyname Contactname Address City

Display Database Companyna me Contactna me AddressCity Big boy Sam 13 th street LA Big girls Mary 14 th street Boston Big pigs John 15 th street NY