Lecture 6 VB.Net SQL Server.

Slides:



Advertisements
Similar presentations
17. Data Access ADO.Net Architecture New Features of ADO.NET
Advertisements

By Chris Pascucci and FLF
Chapter 10 ADO. What is ADO? ADO is a Microsoft technology ADO stands for ActiveX Data Objects ADO is a programming interface to access data in a database.
Introduction to Database Processing with ADO.NET.
1 ADO.NET. 2.NET Framework Data Namespaces System.Data –Base set of classes and interfaces for ADO.NET System.Data.Common –Classes shared by the.NET Data.
Introduction to ADO.Net, VB.Net Database Tools and Data Binding ISYS 512.
ASP.NET Programming with C# and SQL Server First Edition Chapter 8 Manipulating SQL Server Databases with ASP.NET.
Objective In this session we will discuss about : What is ADO. NET ?
From VS C# 2010 Programming, John Allwork 1 VS2010 C# Programming - DB intro 1 Topics – Database Relational - linked tables SQL ADO.NET objects Referencing.
C# programming with database Basic guideline. First step Install SQL Server 2008/2010 (Professional edition if possible) Install Visual Studio 2008/2010.
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.
10-1 aslkjdhfalskhjfgalsdkfhalskdhjfglaskdhjflaskdhjfglaksjdhflakshflaksdhjfglaksjhflaksjhf.
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.
Developing Web Applications Using Microsoft ® Visual Studio ® 2008.
A Simple Introduction. What is ADO.net? First the word ADO stands for ActiveX Data Objects And it is an integral part of.Net Framework of Microsoft hence.
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
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.
Databases and Data Access  Introduction to ADO.NET  ADO.NET objects  ADP.NET namespaces  Differences between ADO and ADO.NET.
.NET Data Access and Manipulation ADO.NET. Overview What is ADO.NET? Disconnected vs. connected data access models ADO.NET Architecture ADO.NET Core Objects.
1 Introduction to ADO.NET Microsoft ADO.NET 2.0 Step by Step Rebecca M Riordan Microsoft Press, 2006.
Copyright ©2004 Virtusa Corporation | CONFIDENTIAL ADO.Net Basics Ruwan Wijesinghe Trainer.
Objectives In this lesson, you will learn to: *Identify the need for ADO.NET *Identify the features of ADO.NET *Identify the components of the ADO.NET.
10/26/20151 Chapter 3 Introduction to ADO.NET In this chapter, you will: Learn the basic classes in ADO.NET and its architecture Learn the different ADO.NET.
Module 9: Accessing Relational Data Using Microsoft Visual Studio.NET.
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
ADO.NET Data Access. Page  2 SQL  When we interact with the datasource through ADO.NET we use the SQL language to retrieve,modify,update information.
Christopher M. Pascucci.NET Programming: Databases & ADO.NET.
Object Oriented Software Development 10. Persistent Storage.
Presented by Joseph J. Sarna Jr. JJS Systems, LLC
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
ADO.NET Objects – Data Providers Dr. Ron Eaglin. Requirements Visual Studio 2005 Microsoft SQL Server 2000 or 2005 –Adventure Works Database Installed.
 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.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 25.1 Test-Driving the ATM Application 25.2.
BSG Group - Dau Anh Trong1 Introduction about MS SQL Server 2005.
HNDIT Rapid Application Development
ADO.NET FUNDAMENTALS BEGINNING ASP.NET 3.5 IN C#.
Module 4 Introduction ADO.NET.
1 Database Programming with ADO.NET Kashef Mughal.
C# .NET Software Development
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.
Querying Information in a Database. CONTENTS Relational Database Systems Creating Database with SQL Server Reading Data with LINQ Requirements to Get.
Introduction to SQL Server  Working with MS SQL Server and SQL Server Management Studio.
ADO .NET from. ADO .NET from “ADO .Net” Evolution/History of ADO.NET MICROSOFT .NET “ADO .Net” Evolution/History of ADO.NET History: Most applications.
Creating SQL Database file And Displaying a Database Table in a DataGridView.
.NET Data Access and Manipulation
C# 1 CSC 298 ADO.NET. C# 2 ADO.NET  A data access technology that maps very well to the world of the web (disconnected architecture)  data is retrieved.
Lecture Select Operation 2. Insert Operation 3. Update Operation 4. Delete Operation.
Integrating Data Lesson 6.
Common SQL keywords. Building and using CASE Tools Data Base with Microsoft SQL-Server and C#
ASP.NET Programming with C# and SQL Server First Edition
Data Access with ADO.NET
Introduction to ADO.NET
Introduction to Database Processing with ADO.NET
Introduction to Database Processing with ADO.NET
JDBC Database Management Database connectivity
ADO.NET Framework.
PROG Advanced Web Apps 5/23/2018 Notes on ADO.NET (1) Wendi Jollymore, ACES.
Programming the Web Using ASP.Net
Active Data Objects Binding ASP.NET Controls to Data
ADO.NET Accessing Databases in VS.NET
VB.NET Using Database.
Tonga Institute of Higher Education
Lecture Set 14 B new Introduction to Databases - Database Processing: The Connected Model (Using DataReaders)
Chapter 10 ADO.
Chapter 10 Accessing Database Files
Active Data Objects Binding ASP.NET Controls to Data
M S COLLEGE OF ART’S, COMM., SCI. & BMS Advance Web Programming
Introduction to ADO.Net and Visual Studio Database Tools.
Presentation transcript:

Lecture 6 VB.Net SQL Server

Contents SQL Vs. SQL Server SQL Server Vs. SQL Server Management Studio Copy Database from one drive to another Drive Connection Steps ADO.net Connection Command Data Adapter Data Set Data Binding to Gridview

SQL vs. SQL Server SQL (Structured Query Language) SQL Server Standard language designed to organize, manage, and retrieve data from a database. Programming language for relational databases SQL Server SQL Server is Microsoft's relational database management system (RDBMS). Handle 1000’s of users. Competitors: Oracle Database (DB) and MySQL. 

SQL Server & SQL Server Management Studio There are two steps for installation: SQL Server 2005 Relational Database Management System .exe extension (Execution File) SQL Server Management Studio Used for configuring, managing, and administering all components within Microsoft SQL Server. .msi extension (Microsoft Installer or Windows Installer) Similar to .exe but One .msi file installation can occur at a time

Copy Database from one drive to another Drive (Detach and Attach) Step 01: Open Microsoft SQL Server 2005 Right Click particular database to be copied (my_database)  Tasks  Detach (Remove) Click Ok on opened Dialog Box Step 02: Copy Database (Default Location: C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data)  Paste on target path. Step 03: Right click on main option of Databases  Attach  Click on Add Button in Open Dialog Box  Now select the location of relocated database (my_database)  Ok

ADO.net (ActiveX Data Object for .NET) Manages communication between your application and data source, through its classes and methods. The connection to the database is disconnected. Database is connected when any changes made to the copy of the database. ADO.net classes are contained in the 'System.Date' namespace. Following are some of the important classes used in ADO.net. Connection Command DataAdapter DataReader DataSet ActiveX: Microsoft-created technology enables different software applications to share information and functionality. 

ADO.net (Connection) The connection string contains the information that the provider need to know to be able to establish a connection to the database or the data file. The ADO.NET Connection class is used to establish a connection to the database. The Connection class uses a Connection String to identify the database server location, authentication parameters, and other information to connect to the database. SqlConnection class is used for MS-SQL server database.  OleDBConnection (Object Link Embedding & Database) is used for databases like Oracle and MS-Access.

System.Data and System.Data.SqlClient Imports System.Data It is a namespace which provides access to classes of ADO.NET architecture. Imports System.Data.SqlClient Can only be used for connecting to SQL Server 2000 and later.

ADO.net (Connection) Connection String example Connection String parts Dim connectionString As String = “ Data Source=.\SqlExpress;Initial Catalog=my_database;Integrated Security=True" Connection String parts .\SqlExpress  Database Server Name Initial Catalog  Database Name Integrated Security  Authentication Note: User Name and Password are optional Creating new instance for connection string Dim connection As New SqlConnection(connectionString)

ADO.net (Command) This class is used to provide the command to be executed on an database. The sql commands include select, update, insert and delete queries. Example: Dim sql As String = "SELECT * FROM Table_1“ Three major method used by this classes are:  ExecuteNonQuery execute commands that don’t return values. ExecuteScalar executes commands that returns a single value. ExecuteReader executes commands that returns a result set.

ADO.net (Data Adapter) This class acts as bridge between the databases and the copy of the database in the memory. Fill method is used to populate the datatset or datatable with data from the database. Update method is used to update the database after the dataset is manipulated. Example: Dim ds As New DataSet() connection.Open() dataadapter.Fill(ds, "Table_1") connection.Close()

ADO.net (Data Set) This class stores the copy of the database retrieved from the original Database. Example: Dim ds As New DataSet()

Connecting Gridview with database Set dataset with Data source of Gridview. DataGridView1.DataSource = ds Connect particular table with Gridview. DataGridView1.DataMember = "Table_1"

Connecting Gridview with database Dim connectionString As String = "Data Source=.\SqlExpress;Initial Catalog=my_database;Integrated Security=True" Dim connection As New SqlConnection(connectionString) Dim sql As String = "SELECT * FROM Table_1" Dim dataadapter As New SqlDataAdapter(sql, connection) Dim ds As New DataSet() connection.Open() dataadapter.Fill(ds, "Table_1") connection.Close() DataGridView1.DataSource = ds DataGridView1.DataMember = "Table_1"