Common SQL keywords. Building and using CASE Tools Data Base with Microsoft SQL-Server and C#

Slides:



Advertisements
Similar presentations
Course ILT Working with related tables Unit objectives Use the Lookup Wizard to create a lookup field and a multivalued field Modify lookup field properties.
Advertisements

Pasewark & Pasewark Microsoft Office XP: Introductory Course 1 INTRODUCTORY MICROSOFT ACCESS Lesson 3 – Creating and Modifying Forms.
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.
Access Lesson 2 Creating a Database
1 Web-Enabled Decision Support Systems Advance Topics in Database Connectivity Prof. Name Position (123) University Name.
Chapter 12: Using ADO.NET 2.0 Programming with Microsoft Visual Basic 2005, Third Edition.
1 Pertemuan 09 Database Matakuliah: D0524 / Algoritma dan Pemrograman Komputer Tahun: 2005 Versi:
Microsoft Visual Basic 2012 CHAPTER TEN Incorporating Databases with ADO.NET.
Access Tutorial 10 Automating Tasks with Macros
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
Pasewark & Pasewark Microsoft Office XP: Introductory Course 1 INTRODUCTORY MICROSOFT ACCESS Lesson 3 – Creating and Modifying Forms.
Databases and LINQ Visual Basic 2010 How to Program 1.
Programming with Microsoft Visual Basic 2012 Chapter 13: Working with Access Databases and LINQ.
Chapter 11 Introduction to Database Processing. Class 11: Database Processing Use a Visual Studio Wizard to establish a database connection used to load.
Programming with Visual Basic.NET An Object-Oriented Approach  Chapter 8 Introduction to Database Processing.
Introduction to ADO.Net and Visual Studio Database Tools ISYS 512.
Microsoft Visual Basic 2010: Reloaded Fourth Edition Chapter Twelve Access Databases and LINQ.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Tutorial 30 – Bookstore Application: Client Tier Examining.
Connecting to Data Sources Using ADO.NET Dr. Awad Khalil Computer Science & Engineering Department AUC.
 2006 Pearson Education, Inc. All rights reserved Database, SQL and ADO.NET.
Module 7: Accessing Data by Using ADO.NET
Course ILT Forms and queries Unit objectives Create forms by using AutoForm and the Form Wizard, and add or modify form headers and footers Open and enter.
Databases with LINQ. LINQ to SQL LINQ to SQL uses LINQ syntax to query databases. LINQ to SQL classes are automatically generated by the IDE’s LINQ to.
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.
Pasewark & Pasewark Microsoft Office 2003: Introductory 1 INTRODUCTORY MICROSOFT ACCESS Lesson 3 – Creating and Modifying Forms.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
Presentation On How To Create Connection To A Database.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
CS 281 – Fall 2015 Lab 4 Parametric Query and Forms in MS Access.
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
1 Database Programming with ADO.NET Kashef Mughal.
T U T O R I A L  2009 Pearson Education, Inc. All rights reserved Address Book Application Introducing Database Programming.
CSCI 3327 Visual Basic Chapter 13: Databases and LINQ UTPA – Fall 2011.
Chapter Fourteen Access Databases and SQL Programming with Microsoft Visual Basic th Edition.
CS 281 – Fall 2010 Lab 4 Parametric Query and Forms in MS Access.
Creating SQL Database file And Displaying a Database Table in a DataGridView.
Programming with Microsoft Visual Basic 2012 Chapter 14: Access Databases and SQL.
Tutorial 1 Creating a Database
Database, SQL and ADO.NET
Microsoft Visual Basic 2010: Reloaded Fourth Edition
Creating Data Base & Sql Data Source
Visual Basic 2010 How to Program
Unit 9.1 Learning Objectives Data Access in Code
VB 2010 Pertemuan 10.
Access Tutorial 1 Creating a Database
Practical Office 2007 Chapter 10
DATABASE CONCEPTS A database is a collection of logically related data designed to meet the information needs of one or more users Data bases are store-houses.
Basic Database Concepts
Lecture 6 VB.Net SQL Server.
SQL MODELER - OPEN There are Three Ways to open the SQL Modeler
Incorporating Databases with ADO.NET
Access Creating a Database
Access Creating a Database
Incorporating Databases with ADO.NET
VB.NET Using Database.
Chapter 7 Advanced Form Techniques
Microsoft Office Access 2003
Access Tutorial 1 Creating a Database
Microsoft Office Access 2003
CIS16 Application Programming with Visual Basic
CIS16 Application Programming with Visual Basic
Introduction to Database Programs
Database Applications
Creating Data Base & Sql Data Source
Access Tutorial 1 Creating a Database
Introduction to Database Programs
Access Tutorial 1 Creating a Database
Database 2.
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

Building and using CASE Tools Data Base with Microsoft SQL-Server and C#

common SQL keywords

Basic SELECT Query

. WHERE Clause

. WHERE Clause

INSERT Statement

UPDATE Statement

DELETE Statement

SQL-Server Database classes Namespace System.Data is the root namespace Namespace System.Data.SqlClient contains classes that are optimized to work with Microsoft SQL Server databases. An object of class SqlConnection (namespace System.Data.SqlClient) represents a connection to a data source specifically a SQL Server database. A SqlConnection object keeps track of the location of the data source and any settings that specify how the data source is to be accessed. An object of class SqlCommand (namespace System.Data.SqlClient) represents a SQL command that a DBMS can execute on a database. A program can use SqlCommand objects to manipulate a data source through a SqlConnection.

SQL-Server Database classes The program must open the connection to the data source before executing one or more SqlCommands and close the connection once no further access to the data source is required. Class DataTable (namespace System.Data) represents a table of data. A DataTable contains a collection of DataRows that represent the table's data. A DataTable also has a collection of DataColumns that describe the columns in a table. DataRow and DataColumn are both located in namespace System.Data. An object of class System.Data.DataSet, which consists of a set of DataTables and the relationships among them, represents a cache of data that a program stores temporarily in local memory. The structure of a DataSet mimics the structure of a relational database.

SQL server Database

Creating SQL Database file And Displaying a Database Table in a DataGridView

Create new windows application project

Click on add new data source option in data source window

In choose data source type dialog box select Dataset then click next

In choose your data connection dialog box click on new connection button

Select Microsoft SQL Server Database file option as a data source then click on continue button

In Add connection dialog box enter a name for the database file ex: database1 then click on ok button

A massage box will appear to tell you that this is a new database would you like to create it? Click on yes button

Now a new database is created with a specific connection string that will be used to connect the application to this database.

Click next

Click on NO button

Click on next

Click on previous button

Click on finish button

Open server explorer then click on database1 Open server explorer then click on database1.mdf then right click on Tables and choose Add new Table option

Add new filed "name" to the table as following

To save changes on the table click on update then Click on update database button

To change table name to "student"

Update the database then close the table

On data source window right click on database1Dataset then choose Configure data source with wizard then choose tables

Then choose table click finish

Drag and drop student table from data source window to the form

Run the program

Add new record then click save

Remove the record then click save

How Data Binding Works The technique through which GUI controls are connected to data sources is known as data binding. The IDE allows controls, such as a DataGridView, to be bound to a data source, such as a DataSet that represents a table in a database. Any changes you make through the application to the underlying data source will automatically be reflected in the way the data is presented in the data-bound control (e.g., the DataGridView). Likewise, modifying the data in the data-bound control and saving the changes updates the underlying data source.

Create new windows application then create SQL-server database with following tables Course int Cno Cmark stId Student int stId Nvarchar(50) stName

Drag and drop student table and Add a button “print names” to your form to print all student names as following

To print all student names in student table add the following code to the button “print names” event handler

Run the program and add the following students to student table

Then click the button the following message box will be shown with names of all students

Add three textboxes and three labels to the form as following then add new button “Add course” to add new course to table course in the database

In button “Add course” event handler add the following code

Add new button “print AVG” to the form to find the average for all marks in course table as following

Add the following code to button “print AVG” event handler

Add the following courses to course table then find the average of all marks

Click on print AVG button