1 Lecture 05 Project: C#, ASP,.NET Friday, January 13, 2006.

Slides:



Advertisements
Similar presentations
Query Methods (SQL). What is SQL A programming language for databases. SQL (structured Query Language) It allows you add, edit, delete and run queries.
Advertisements

Adding a database to web service Add a database – Service->Add new item->SQL server database Add table to database – Server explorer->tables->Add new table.
ASP.NET Data Binding. Slide 2 Lecture Overview Understanding the ASP.NET data binding model.
Introduction to Database Processing with ADO.NET.
Performed by:Gidi Getter Svetlana Klinovsky Supervised by:Viktor Kulikov 08/03/2009.
PHP & MySQL Mahak Arora Vivek Bangera. Outline How PHP works Basic scripting in PHP Forms in PHP(GET & POST Variables) SQL basics PHP and MySQL connection.
CSCI 6962: Server-side Design and Programming
CSCI 6962: Server-side Design and Programming JDBC Database Programming.
June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 1 Lecture 8 Object Oriented Programming in Java Advanced Topics Java Database.
BIT 286: Web Applications Lecture 04 : Thursday, January 15, 2015 ASP.Net MVC - Models.
IS-907 Java EE JPA: Simple Object-Relational Mapping.
ADO.NET A2 Teacher Up skilling LECTURE 3. What’s to come today? ADO.NET What is ADO.NET? ADO.NET Objects SqlConnection SqlCommand SqlDataReader DataSet.
1 ASP.NET ASP.NET Rina Zviel-Girshin Lecture 4. 2 Overview Data Binding Data Providers Data Connection Data Manipulations.
Distributed Systems (236351) Tutorial 1 - Getting Started with Visual Studio C#.NET.
Database Programming Dr. John Abraham. Data Sources Data source specifies the source of the data for an application. Click on Data from Menu Choose show.
Database Queries. Queries Queries are questions used to retrieve information from a database. Contain criteria to specify the records and fields to be.
ADO.Net CS795. What is ADO.Net? Database language spoken by managed applications ADO.net database accesses go through modules: data providers –SQL Server.Net.
Java Quiz Bowl A fun review of the Java you should know from CMPT 201 If you don’t know the answers - this week is for you to study up!
11 Using ADO.NET II Textbook Chapter Getting Started Last class we started a simple example of using ADO.NET operations to access the Addresses.
CSCI 6962: Server-side Design and Programming Database Manipulation in ASP.
1 Introduction to Database Systems CSE 444 Lecture 06 SQL in C#, Project October 5, 2007.
ASP.NET The Clock Project. The ASP.NET Clock Project The ASP.NET Clock Project is the topic of Chapter 23. By completing the clock project, you will learn.
ASP.NET Rina Zviel-Girshin Lecture 5
Session 8: ADO.NET. Overview Overview of ADO.NET What is ADO.NET? Using Namespaces The ADO.NET Object Model What is a DataSet? Accessing Data with ADO.NET.
Module 7: Accessing Data by Using ADO.NET
 Page_Init  Page_Load  cmdINew_Click  cmdISave_Click  cmdIDelete_Click  cmdISubmit_Click  cmdIClear_Click  gridLineItem_RowEditing  gridLineItem_RowDeleting.
ASP.NET More on searching databases 1ASP.NET, More on searching databases.
Copyright  Oracle Corporation, All rights reserved. 7 Accessing a Database Using SQLJ.
8 1 Chapter 8 Advanced SQL Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
CSSE501 Object-Oriented Development. Chapter 4: Classes and Methods  Chapters 4 and 5 present two sides of OOP: Chapter 4 discusses the static, compile.
 It is the primary data access model for.Net applications  Next version of ADO  Can be divided into two parts ◦ Providers ◦ DataSets  Resides in System.Data.
Bill Campbell, UMB Microsoft's.NET C# and The Common Language Runtime.
© Stefano Grazioli - Ask for permission for using/quoting:
CSCI 6962: Server-side Design and Programming JSF DataTables and Shopping Carts.
Sadegh Aliakbary Sharif University of Technology Fall 2012.
ASP.NET - insert - delete -update DataTables (disconnected datasets) Shopping Basket.
Database Management System. DBMS A software package that allows users to create, retrieve and modify databases. A database is a collection of related.
ADO.Net CS795. What is ADO.Net? Database language spoken by managed applications ADO.net database accesses go through modules: data providers –SQL Server.Net.
1 11/15/05CS360 Windows Programming ADO.NET Continued.
Access Databases from Java Programs via JDBC Tessema M. Mengistu Department of Computer Science Southern Illinois University Carbondale
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
EGR 115 Introduction to Computing for Engineers
1 Database Programming with ADO.NET Kashef Mughal.
Advanced Databases More Advanced PL/SQL Programing 1.
Introduction to C# Anders Hejlsberg Distinguished Engineer Developer Division Microsoft Corporation.
DataGridView. Displaying data in a tabular format is a task you are likely to perform frequently. The DataGridView control is designed to be a complete.
.NET Data Access and Manipulation
1 Lecture 07 Project Wednesday, October 11, 2006.
Common SQL keywords. Building and using CASE Tools Data Base with Microsoft SQL-Server and C#
Introduction to Database Processing with ADO.NET
Introduction to Database Processing with ADO.NET
Programming the Web Using ASP.Net
Lecture 6 VB.Net SQL Server.
Structs.
Eric Hill, Software Developer, JMP
CS-0401 INTERMEDIATE PROGRAMMING USING JAVA
Introduction to Database Systems CSE 544
Tonga Institute of Higher Education
Database Queries.
מתחברים למסד נתונים היכרות עם ADO.Net.
An Introduction to Java – Part I, language basics
برنامه نویسی سیستم های شی گرا
Stores data in different tables
Class Everything if Java is in a class. The class has a constructor that creates the object. public class ClassName private Field data (instance variables)
What Color is it?.
These slides are for reference only. They are not "lecture notes"
PROG Advanced Web Apps 4/13/2019 Programming Data Pages Wendi Jollymore, ACES.
Simple MS Access operations
Lecture 06 SQL in C#, Project
Java-Assignment #4 (Due, April. 9, 2004)
Presentation transcript:

1 Lecture 05 Project: C#, ASP,.NET Friday, January 13, 2006

2 C# - Outline Hello World Properties (getters/setters) Enums Partial classes Dataset: DataTable, DataRow Connecting to a database

3 C# - Highlights C# = C++.Sytnax + Java.Semantics It is a “safe” language (like Java) Can be embedded in Webpages Can access a database –Complex, but you should see the predecessors !

4 using System; class Hello { static void Main() { Console.WriteLine("Hello world"); } using System; class Hello { static void Main() { Console.WriteLine("Hello world"); } Hello World

5 public class Point { private int x; private string c; public int position { get { return x; } set { x = value; c = “red”; } } public string color { get { return c; } set { c = value; x++; } } public class Point { private int x; private string c; public int position { get { return x; } set { x = value; c = “red”; } } public string color { get { return c; } set { c = value; x++; } } Properties: Getters and Setters Point uvw = new point(); uvw.position = 55; uvw.color = “green”; uvw.position = uvw.position * 2; if (uvw.color == “green”)…

6 Indexers Getters and setters with […] public class Stuff { private int x[]; public int this[int i] { get {x[2*i+1]=0; return x[2*i]; } set { x[2*i] = value; x[2*i+1]=1; } } public class Stuff { private int x[]; public int this[int i] { get {x[2*i+1]=0; return x[2*i]; } set { x[2*i] = value; x[2*i+1]=1; } } Stuff uvw = new Stuff(); uvw[12] = 55; uvw[99] = uvw[12]*7 + 2;

7 enum Color: byte { Red = 1, Green = 2, Blue = 4, Black = 0, White = Red | Green | Blue, } enum Color: byte { Red = 1, Green = 2, Blue = 4, Black = 0, White = Red | Green | Blue, } Enum

8 Partial Classes Some fields defined in file 1 Other fields defined in file 2 Why ? Nathan creates file 1, you create file 2

9 Dataset Dataset: DataTable DataRow

10 DataSet myLocalDB = new DataSet(); /* create inside a table called “books” */..... /* now use “books” */ DataTable x = myLocalDB.Tables[“books”] foreach (DataRow y in x.Rows) { if (y[“title”] == “Harry Potter”) y[“price”]++;; } DataSet myLocalDB = new DataSet(); /* create inside a table called “books” */..... /* now use “books” */ DataTable x = myLocalDB.Tables[“books”] foreach (DataRow y in x.Rows) { if (y[“title”] == “Harry Potter”) y[“price”]++;; } DataSet

11 Connecting to a Database Create or edit web.config file –Specify iisqlsrv, user, password –Give a ‘name’ Create a SqlConnection –refer to ‘name’ Create a SqlDataAdaptor –embed SQL query string Execute the Fill( ) method to run query and store answers in a datarow

12 SqlConnection c = new SqlConnection(... “name”...); string q = “select distinct year from products where price < 100”; SqlDataAdapter a = new SqlDataAdapter(q, c); DataSet myLocalDB = new DataSet(); a.Fill(myLocalDB, “years”); SqlConnection c = new SqlConnection(... “name”...); string q = “select distinct year from products where price < 100”; SqlDataAdapter a = new SqlDataAdapter(q, c); DataSet myLocalDB = new DataSet(); a.Fill(myLocalDB, “years”); Connecting to a Database SQL = a string !!! “impedance mismatch”