You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
description: Introduces how to open SQL Server databases by using SQL Server .NET Data Provider with Visual Basic .NET.
4
-
ms.date: 05/12/2020
2
+
title: Open SQL Database By Using VB .NET
3
+
description: Introduces how to open SQL Server databases by using SQL Server .NET Data Provider together with Visual Basic .NET.
4
+
ms.date: 07/07/2025
5
5
ms.topic: how-to
6
6
ms.custom: sap:Class Library Namespaces
7
-
---
8
-
# Open SQL Server database by using SQL Server .NET Data Provider with Visual Basic .NET
9
7
10
-
This article provides information about how to open SQL Server databases by using SQL Server .NET Data Provider with Visual Basic .NET.
8
+
#customer intent: As a developer, I want to open SQL Server databases by using the SQL Server .NET Data Provider together with Visual Basic .NET so that I can integrate SQL Server with my applications.
9
+
---
10
+
# Open SQL Server database by using SQL Server .NET Data Provider with Visual Basic .NET
This article provides information about how to open Microsoft SQL Server databases by using SQL Server .NET Data Provider together with Visual Basic .NET. You can use ADO.NET to open a SQL Server database by using the SQL Server .NET Data Provider. ADO.NET gathers all the classes that are required for data handling.
14
13
15
-
## Summary
14
+
The `System.Data.SqlClient` namespace describes a collection of classes that are used to programmatically access a SQL Server data source. You can access ADO classes through the `System.Data.OleDb` namespace to provide support for OLE DB databases.
16
15
17
-
This article describes how you can use ADO.NET to open a SQL Server database by using the SQL Server .NET data provider. ADO.NET gathers all of the classes that are required for data handling. The `System.Data.SqlClient` namespace describes a collection of classes that are used to programmatically access a SQL Server data source. You can access ADO classes through the `System.Data.OleDb` namespace to provide support for OLE DB databases.
16
+
In this article, connections are set up both programmatically and by using the Visual Studio .NET Server Explorer. The code samples in this article use the `SqlConnection`, `SqlCommand`, and `SqlDataReader`ADO.NET objects.
18
17
19
-
In this article, connections are set up both programmatically and using the Visual Studio .NET Server Explorer. The code samples in this article use the `SqlConnection`, `SqlCommand`, and `SqlDataReader` ADO.NET objects.
18
+
_Applies to:_Visual Basic .NET
20
19
21
-
## Requirements
20
+
_Original KB number:_ 308656
22
21
23
-
The following list outlines the required hardware, software, network infrastructure, and service packs that you need:
22
+
## Prerequisites
24
23
25
24
- Microsoft SQL Server
26
25
- Visual Basic .NET
27
26
28
-
> [!NOTE]
29
-
> SQL Server and Visual Basic .NET must be installed and running on the same computer. In addition, the user must be able to use Windows Integrated Security to connect to SQL Server.
27
+
> [!NOTE]
28
+
> SQL Server and Visual Basic .NET must be installed and running on the same computer. Additionally, the user must be able to use Windows Integrated Security to connect to SQL Server.
30
29
31
30
This article assumes that you're familiar with the following topics:
32
31
33
32
- ADO.NET concepts
34
33
- SQL Server concepts and Transact-SQL (T-SQL) syntax
35
-
-*Northwind* sample database
34
+
-The _Northwind_ sample database
36
35
37
36
## Create Visual Basic .NET Windows application
38
37
39
-
1. Start Visual Studio .NET, and create a new Visual Basic Windows Application project named *SQLDataAccess*.
40
-
2. Open Form1. In the first line of *Form1.vb*, add a reference to the ADO.NET namespace as follows:
38
+
1. In Visual Studio .NET, create a Visual Basic Windows Application project, and name it _SQLDataAccess_.
39
+
2. Open Form1.
40
+
3. In the first line of _Form1.vb_, add a reference to the ADO.NET namespace, as follows:
2.Dragthe**FirstName**and**LastName**databasefieldsfrom`Employees` tableinServerExplorer,anddropthesefieldsontoForm1.A`SqlConnection` and `SqlDataAdapter` objectarecreatedontheform.
0 commit comments