Ch. 101 Virtual Table and DataGridView Virtual Table DataGridView.

Slides:



Advertisements
Similar presentations
Integrated Business Applications with Databases (D3) Jenny Pedler
Advertisements

20 th largest metropolitan city in the world – Beijing, China at 12 million.
Chapter 14.3 LINQ to SQL Programming in Visual Basic 2010: The Very Beginner’s Guide by Jim McKeown Databases – Part 3.
Chapter 18 - Data sources and datasets 1 Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
1 Web-Enabled Decision Support Systems Advance Topics in Database Connectivity Prof. Name Position (123) University Name.
Ch. 101 DataTable Data Table Object A DataTable object holds the contents of a table as a rectangular array. A data table is similar to a two-dimensional.
1 Lab 2 HRP223 – 2010 October 18, 2010 Copyright © Leland Stanford Junior University. All rights reserved. Warning: This presentation is protected.
VB.NET Database Tools ISYS Net Applications OLE DB Provider OLE DB Data Source OLE DB Provider ODBC Data Source SQL Server Data Source SQL Server.Net.
Ch. 101 Changing the Contents of a Database. Ch. 102 Changing the Contents of a Database Data grid views can also be used to add, modify, and delete records.
Chapter 41 Function Procedures (Continue I). Chapter 42 Lab Sheet 4.7: Code Private Sub btnCalculate_Click(...) _ Handles btnCalculate.Click Dim a, b.
Chapter 71 Using Part of an Array Sometimes we do not know how many elements will be needed in an array. We can declare a large array, say of 100 elements,
Megacity Challenge
Instructor: Adil Ibrahim Office: 212 Ullrich Phone: ibrahima 1.
20 th largest metropolitan city in the world – Beijing, China at 12 million.
CS 2340: Programming in VB Instructor: Dr. Qi Yang Office: 213 Ullrich Phone: YangQ 1.
Some Basic Database Terminology
Chapter 10 - VB.Net by Schneider1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Relational Databases and SQL.
CS 2340 Programming in VB.NET Instructor: Dr. Qi Yang Office: 213 Ullrich Phone: YangQ 1.
Chapter 11 Introduction to Database Processing. Class 11: Database Processing Use a Visual Studio Wizard to establish a database connection used to load.
Copyright © 2001 by Wiley. All rights reserved. Chapter 10: Advanced Database Operations Revising Vintage Videos Setting RecordSource at run time DBGrid.
Ch VB 2008 by Schneider1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Relational Databases and SQL.
P RACTICE Determine the output displayed when the button is clicked. Dim actor(5,5) As String Private Sub btnDisplay_Click(...) Handles btnDisplay.Click.
Advanced Visual Basic th Edition Chapter 3: Using SQL Server Databases (c) 2007 Pearson Education Inc. All rights reserved. You may modify and copy.
CIS 451: Using ASP.NET Objects with SQL Dr. Ralph D. Westfall February, 2009.
Developing Web Applications Using Microsoft ® Visual Studio ® 2008.
1/36 Database Programming with Visual Basic.Net and MS Access IKE Lab. Yunho Song Database Management and Analysis.
Let’s get started using Visual Basic!. Private Sub cmdGo_Click... Dim strMessage As String Dim sngSum As Single If IsNumeric(txtNumber1.Text) = False.
1 Databound Controls. 2 Objectives You will be able to use design time data binding to display and update SQL Server database data without writing any.
Revision Exercise: Control Which control will you use to display your name? ____________ Which control will you use to get user’s click action? ____________.
Data files and databases. Need a control to browse to a file Standard controls for drive folder and list not much use The CommonDialogs control offers.
Programming Test #1 Solutions. Multiple Choice 1. B) the grammar of the coding language 2. C) String 3. A) Single 4. C) 2Burgers4Me 5. B) Design Time.
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.
1 Lab 2 and Merging Data (with SQL) HRP223 – 2009 October 19, 2009 Copyright © Leland Stanford Junior University. All rights reserved. Warning:
1 Project 7: Northwind Traders Order Entry. 2 Northwind Order Entry Extend the Select Customer program from Project 6 to permit the user to enter orders.
1 CS 3870/CS 5870: Note 07 Lab 3 Lab 4 Test 1: Two Tables.
Ch Determine the output displayed from procedures Lab sheet 10.4.
Chapter 10 - VB.Net by Schneider1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Relational Databases and SQL.
Programming in R SQL in R. Running SQL in R In this session I will show you how to: Run basic SQL commands within R.
ADO.NET Objects – Data Providers Dr. Ron Eaglin. Requirements Visual Studio 2005 Microsoft SQL Server 2000 or 2005 –Adventure Works Database Installed.
6c – Function Procedures Lingma Acheson Department of Computer and Information Science, IUPUI CSCI N331 VB.NET Programming.
1 CS 3870/CS 5870: Note05 Prog3 Web Application with Database.
Grade Book Database Presentation Jeanne Winstead CINS 137.
1 Chapter 20 – Data sources and datasets Outline How to create a data source How to use a data source How to use Query Builder to build a simple query.
1 Advanced Computer Programming Lab Calculator Project.
Ch. 101 Database Management An Introduction to Databases.
ME 142 Engineering Computation I Using Subroutines Effectively.
Lab 6 (2) Arrays ► Lab 5 (1) Exercise Review ► Array Concept ► Why Arrays? ► Array Declaration ► An Example of Array ► Exercise.
Chapter 71 Arrays Creating and Accessing Arrays Using Arrays Some Additional Types of Arrays.
Pay Example (PFirst98) Please use speaker notes for additional information!
Module 3: Working with Local Data. Overview Using DataSets Using XML Using SQL Server CE.
Visual Basic I/O Programs (ProjRead1, ProjRead2, ProjWrite1, ProjPay) Please use speaker notes for additional information!
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 25 I’m Suffering from Information Overload.
1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Editing and Designing Databases.
Chapter 24 I’m Suffering from Information Overload (Access Databases) Clearly Visual Basic: Programming with Visual Basic nd Edition.
Created by Alia Al-Abdulkarim 2008 Visual Basic Vs. Java.
ADO.NET in VB.NET 2005 ITE 370 4/26/2017.
Ch VB 2005 by Schneider1 Chapter 10 – Database Management 10.1 An Introduction to Databases 10.2 Relational Databases and SQL.
Using ADO.Net to Build a Login System Dr. Ron Eaglin.
ADO.NET Objects Data Adapters Dr. Ron Eaglin. Agenda Builds on Information in Part I Should have working knowledge of creating a database connection Continuation.
Using a Database Access97 Please use speaker notes for additional information!
Querying Information in a Database. CONTENTS Relational Database Systems Creating Database with SQL Server Reading Data with LINQ Requirements to Get.
Ch. 101 DataTable (Continue) Lab sheet 10.3: Form Display Cities table along with percentage growth.
Creating SQL Database file And Displaying a Database Table in a DataGridView.
DAY 20: ACCESS CHAPTERS 5, 6, 7 Larry Reaves October 28,
Stored Procedures Dr. Ralph D. Westfall May, 2011.
The Check Box Control Consists of a small square and a caption
Department Array in Visual Basic
Chapter 10 – Database Management
Lab 2 and Merging Data (with SQL)
Introduction to Computer Programming IT-104
Presentation transcript:

Ch. 101 Virtual Table and DataGridView Virtual Table DataGridView

Ch. 102 Virtual Tables SQL statements create a new “virtual” table from existing tables. Think of the following statement as creating a "virtual table" SELECT city, pop2015 FROM Cities WHERE pop2015>=20 Results in: city pop2015 Bombay 22.6 Delhi 20.9 Mexico City 20.6 Sao Paulo 20.0 Tokyo 36.2

Ch. 103 Another Virtual Table SELECT * FROM Countries WHERE country Like 'I%' ORDER BY pop2005 ASC Results in: country pop2005 monetaryUnit Indonesia rupiah India rupee

Ch. 104 Views “Virtual” tables don’t exist physically. For all practical purposes, Visual Basic acts as if they did. You may also see a “virtual” table called a view.

Ch. 105 The DataGridView Control The DataGridView displays the values for an entire view in a table format similar to the table displayed by Database Explorer. The prefix for the name of a DataGridView control is dgv. After a data table has been filled, the statement dgvDisplay.DataSource = dt displays the contents of the data table dt in the data grid.

Ch. 106 Lab sheet 10.5: Form dgvDisplay

Ch. 107 Lab sheet 10.5: Code Private Sub frmCities_Load(...) Handles MyBase.Load UpdateGrid("Select * From Cities") End Sub Private Sub btnOrderbyPop_Click(...) Handles btnOrderbyPop.Click UpdateGrid("Select * From Cities Order By pop2005 ASC") End Sub Private Sub btnShowMonUnit_Click(...) _ Handles btnShowMonUnit.Click UpdateGrid("SELECT city, Cities.country, " & _ "Cities.pop1995, monetaryUnit " & _ "FROM Cities INNER JOIN Countries " & _ "ON Cities.country=Countries.country " & _ "ORDER BY city ASC") End Sub

Ch. 108 Example Lab sheet 10.5: Code continued Sub UpdateGrid(ByVal sqlStr As String) Dim dt As New DataTable() Dim connStr As String ="Provider=Microsoft.Jet.OLEDB.4.0;" & _ "Data Source = MEGACITIES.MDB" Dim dataAdapter As New OleDb.OleDbDataAdapter(sqlStr, connStr) dataAdapter.Fill(dt) dataAdapter.Dispose() dgvDisplay.DataSource = dt End Sub

Ch. 109 Lab sheet 10.5: Output Click on the “Show Monetary Unit” button.

Ch Lab sheet 10.6: Form dgvDisplay txtCountry

Ch Lab sheet 10.6: Code Private Sub btnFindCities_Click(...) _ Handles btnFindCities.Click UpdateGrid("SELECT city FROM Cities WHERE" & _ "country = '" & txtCountry.Text & _ "' ORDER BY city ASC") End Sub Sub UpdateGrid(ByVal sqlStr As String) (Boilerplate, except for Dim sqlStr statement) If dt.Rows.Count = 0 Then MsgBox("No cities from that country " & _ "in the database") Else dgvDisplay.DataSource = dt End If End Sub

Ch Lab sheet 10.6: Output