Presentation is loading. Please wait.

Presentation is loading. Please wait.

Querying Information in a Database. CONTENTS Relational Database Systems Creating Database with SQL Server Reading Data with LINQ Requirements to Get.

Similar presentations


Presentation on theme: "Querying Information in a Database. CONTENTS Relational Database Systems Creating Database with SQL Server Reading Data with LINQ Requirements to Get."— Presentation transcript:

1 Querying Information in a Database

2 CONTENTS Relational Database Systems Creating Database with SQL Server Reading Data with LINQ Requirements to Get Data From Database Step by Step Writing Data to on DataBase Summary Examples Questions

3 Relational Database Systems Oracle FoxPro IBM DB2 Linter Microsoft Access Microsoft SQLServer MySQL PostgreSQL SQLite

4 Creating Database with MySQL

5

6

7

8

9 Reading Data with LINQ

10

11

12

13 Requirements to Get Data From Database Step by Step Adding Namespace Creating Connection and Opening it Determine the SqlDataAdapter Reading Data Closing Connection

14 Adding Namespace System.Data.SqlClient (the.NET Framework Data Provider for SQL Server) System.Data.Odbc (the.NET Framework Data Provider for ODBC) System.Data.OracleClient (the.NET Framework Data Provider for Oracle) System.Data.OleDb (the.NET Framework Data Provider for OLE DB)

15 Connection The Connection Object is a part of ADO.NET Data Provider and it is a unique session with the Data Source The Connection Object is Handling the part of physical communication between the C# application and the Data Source Opening connection is like opening a folder

16 Connection SqlConnection conn = new SqlConnection(); Con.ConnectionString = @“…”; Con.Open();

17 SqlDataAdapter A data adapter is an object used to exchange data between a data source and a data set

18 SqlDataAdapter

19 Reading Data and Closing Connection DataGridView displays data from SQL databases. This tutorial shows how to display a specific table from a database and display it on a DataGridView. This is done with a DataAdapter DataGridView.DataSource = DataTable; Conn.Close(); //Important to close connection

20 Writing Data to on DataBase Use SqlCommand Use ExecuteNonQuery string Kmt = "INSERT INTO Customers (CustomerID,CompanyName,ContactName,City) VALUES ('" + textBox1.Text + "','" + textBox2.Text + "', …) "; SqlCommand komut = new SqlCommand(Kmt, baglanti); komut.ExecuteNonQuery();

21

22

23

24


Download ppt "Querying Information in a Database. CONTENTS Relational Database Systems Creating Database with SQL Server Reading Data with LINQ Requirements to Get."

Similar presentations


Ads by Google