Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 9

DATA ACCESS IN

VB.NET
INTRODUCATION

.NET Framework consists of the common language runtime (CLR) and the .NET
Framework class library. The common language runtime is the foundation of .NET
Framework. Think of the runtime as an agent that manages code at execution time,
providing core services such as memory management, thread management, and
remoting, while also enforcing strict type safety and other forms of code accuracy
that promote security and robustness. In fact, the concept of code management is a
fundamental principle of the runtime. Code that targets the runtime is known as
managed code, while code that doesn't target the runtime is known as unmanaged
code. The class library is a comprehensive, object-oriented collection of reusable
types that you use to develop apps ranging from traditional command-line or
graphical user interface (GUI) apps to apps based on the latest innovations provided
by ASP.NET, such as Web Forms and XML web services.

2
ARCHITECTURE OF ADO .NET

3
ACCESSING DATA WITH SERVER
EXPLORER
⊡ Click “Connect to Database” in the Server Explorer window (if its not visible, you can
open it from the View menu, then click Server Explorer.)
⊡ Follow these steps in the Data Link Properties dialog box:
□ In the Select or enter a server name text box, type localhost.
□ Under Enter information to log on to the server, ( if you need security click Use
Windows NT Integrated security).
⊡ Click Select the database on the server, and then select Database from the list of
databases(eg Northwind ).
□ Click Test Connection to verify that the information is correct, and then click OK.
⊡ In the Customers table, select the following columns:Company Name Contact Name
Contact Title
⊡ Right-click in the SQL pane, and then click Verify SQL Syntax.
⊡ Right-click in the diagram pane, and then click Run.
⊡ Click Save, and then type CustomerInfo for the view.

4
DATA PROVIDERS

DATA PROVIDERS

5
IN TWO OR THREE COLUMNS

CONNECTION, DATA READER, DATA ADAPTERS AND DATASETS

6
CREATE NEW DATA CONNECTION

CREATE NEW DATA CONNECTION


⊡ The .Net Framework provides two types of Connection classes
⊡ SqlConnection − designed for connecting to Microsoft SQL Server.
⊡ OleDbConnection − designed for connecting to a wide range of databases,
like Microsoft Access and Oracle.
⊡ Example
⊡ In this example, let us access data in a DataGridView control using code. Take
the following steps −
⊡ Add a DataGridView control and a button in the form.
⊡ Change the text of the button control to 'Fill'.
⊡ Double click the button control to add the required code for the Click event of
the button

7
DATA GRID CONTROL AND DISPLAYING DATA IN DATA GRID

⊡ The DataAdapter uses the Connection object of the . NET data provider to connect to
adata source, and Command objects to retrieve data from and resolve changes to the
datasource. The SelectCommand property of the DataAdapter is a Command object
that retrieves data from the data source.

8
THANK YOU

You might also like