Skip to content

Commit 4e68004

Browse files
Merge pull request #13700 from MicrosoftDocs/ghogen-patch-95
Add Visual Basic "Compile" tab
2 parents e30e46b + 14a9241 commit 4e68004

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

docs/data-tools/connect-to-data-in-an-access-database-windows-forms.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: Connect to Access database in .NET Framework apps
33
description: Connect to data stored in an Access database (.mdb file or .accdb file) from .NET Framework applications with ADO.NET in Visual Studio.
4-
ms.date: 05/02/2024
4+
ms.date: 03/12/2025
55
ms.topic: how-to
66
helpviewer_keywords:
77
- data [Visual Studio], connecting
@@ -20,20 +20,20 @@ ms.subservice: data-tools
2020
You can connect to an Access database (either an `.mdb` file or an `.accdb` file) by using Visual Studio. After you define the connection, the data appears in the **Data Sources** window. From there, you can drag tables or views onto your design surface.
2121

2222
> [!NOTE]
23-
> If you're using Visual Studio to connect to Access databases, you will need to be aware that versions of Visual Studio prior to Visual Studio 2022 are all 32-bit processes. This means some of the data tools in Visual Studio 2019 and earlier will only be able to connect to Access databases using 32-bit data providers.
23+
> If you're using Visual Studio to connect to Access databases, be aware that versions of Visual Studio prior to Visual Studio 2022 are all 32-bit processes. This means some of the data tools in Visual Studio 2019 and earlier can only connect to Access databases using 32-bit data providers.
2424
>
25-
> If you're using Visual Studio 2022 to connect to Access databases, you will need to be aware that Visual Studio 2022 is now a 64-bit process. This means some of the data tools in Visual Studio will not be able to connect to Access databases using 32-bit data providers.
25+
> If you're using Visual Studio 2022 to connect to Access databases, be aware that Visual Studio 2022 is now a 64-bit process. This means some of the data tools in Visual Studio can't connect to Access databases using 32-bit data providers.
2626
>
27-
> If you need to maintain 32-bit applications that connect to Access databases, you will still be able to build and run the application with Visual Studio 2022. However, if you need to use any of the Visual Studio Data Tools such as Server Explorer, Data Source Wizard, or the DataSet Designer, you will need to use an earlier version of Visual Studio that is still a 32-bit process. The last version of Visual Studio that was a 32-bit process was Visual Studio 2019.
27+
> If you need to maintain 32-bit applications that connect to Access databases, you can still build and run the application with Visual Studio 2022. However, if you need to use any of the Visual Studio Data Tools such as Server Explorer, Data Source Wizard, or the DataSet Designer, you need to use an earlier version of Visual Studio that is still a 32-bit process. The last version of Visual Studio that was a 32-bit process was Visual Studio 2019.
2828
>
29-
> If you plan on converting the project to be a 64-bit process, it's recommended that you use the 64-bit Microsoft Access database Engine, also called Access Connectivity Engine (ACE). Please see [OLE DB Provider for Jet and ODBC driver are 32-bit versions only](/office/troubleshoot/access/jet-odbc-driver-available-32-bit-version) for more information.
29+
> If you plan on converting the project to be a 64-bit process, it's recommended that you use the 64-bit Microsoft Access database Engine, also called Access Connectivity Engine (ACE). See [OLE DB Provider for Jet and ODBC driver are 32-bit versions only](/office/troubleshoot/access/jet-odbc-driver-available-32-bit-version).
3030
3131
## Prerequisites
3232

3333
To use these procedures, you need:
3434

3535
- [Visual Studio](../install/install-visual-studio.md)
36-
- A Windows Forms or WPF project
36+
- A Windows Forms or Windows Presentation Foundation (WPF) project
3737
- Either an Access database (`.accdb` file), or an Access 2000-2003 database (`.mdb` file). Follow the procedure that corresponds to your file type.
3838

3939
:::moniker range=">=vs-2022"
@@ -77,7 +77,7 @@ Connect to databases created with Microsoft 365, Access 2016, Access 2013, Acces
7777
8. Choose **Browse** next to **Database file name**, and then navigate to your `.accdb` file and choose **Open**.
7878

7979
> [!NOTE]
80-
> If the bitness (32-bit or 64-bit) of Microsoft Office and Visual Studio do not match, you will see an error while connecting to an Access database. In Visual Studio 2019, you will get an error that the database provider is not registered. In Visual Studio 2022, you will see an error that you can't connect to a 32-bit data provider. To resolve this error, make sure that if you are using a 32-bit version of Office, you are using Visual Studio 2019 or earlier; for a 64-bit version of Office, you need Visual Studio 2022 or later.
80+
> If the bitness (32-bit or 64-bit) of Microsoft Office and Visual Studio do not match, you see an error while connecting to an Access database. In Visual Studio 2019, you get an error that the database provider is not registered. In Visual Studio 2022, you see an error that you can't connect to a 32-bit data provider. To resolve this error, make sure that if you are using a 32-bit version of Office, you are using Visual Studio 2019 or earlier; for a 64-bit version of Office, you need Visual Studio 2022 or later.
8181
8282
9. Enter a user name and password (if necessary), and then choose **OK**.
8383

@@ -99,7 +99,7 @@ Connect to databases created with Microsoft 365, Access 2016, Access 2013, Acces
9999

100100
![Screenshot of Data Sources Window, populated with database objects](media/vs-2022/data-sources-window-populated.png)
101101

102-
14. On 64-bit machines with the 64-bit Access database engine, you need to ensure that the application runs as a 64-bit application. Open the project properties (press **Alt**+**Enter** or right-click on the project node, and select **Properties**). In the **Build** tab, clear the **Prefer 32-bit** checkbox.
102+
14. On 64-bit machines with the 64-bit Access database engine, you need to ensure that the application runs as a 64-bit application. Open the project properties (press **Alt**+**Enter** or right-click on the project node, and select **Properties**). In the **Build** tab for C#, or the **Compile** tab for Visual Basic, clear the **Prefer 32-bit** checkbox.
103103

104104
The connection string is stored in *app.config*, and in the *Settings.settings* file under **Properties** in Solution Explorer.
105105

@@ -144,7 +144,7 @@ Connect to databases created with Microsoft 365, Access 2016, Access 2013, Acces
144144
8. Choose **Browse** next to **Database file name**, and then navigate to your `.accdb` file and choose **Open**.
145145

146146
> [!NOTE]
147-
> If the bitness (32-bit or 64-bit) of Microsoft Office and Visual Studio do not match, you will see an error while connecting to an Access database. In Visual Studio 2019, you will get an error that the database provider is not registered. In Visual Studio 2022, you will see an error that you can't connect to a 32-bit data provider. To resolve this error, make sure that if you are using a 32-bit version of Office, you are using Visual Studio 2019 or earlier; for a 64-bit version of Office, you need Visual Studio 2022 or later.
147+
> If the bitness (32-bit or 64-bit) of Microsoft Office and Visual Studio do not match, you see an error while connecting to an Access database. In Visual Studio 2019, you get an error that the database provider is not registered. In Visual Studio 2022, you see an error that you can't connect to a 32-bit data provider. To resolve this error, make sure that if you're using a 32-bit version of Office, you're using Visual Studio 2019 or earlier; for a 64-bit version of Office, you need Visual Studio 2022 or later.
148148
149149
9. Enter a user name and password (if necessary), and then choose **OK**.
150150

@@ -206,7 +206,7 @@ Congratulations! With a little help from Visual Studio, you've created a form-ba
206206

207207
## Next steps
208208

209-
The dataset that you just created is available in the **Data Sources** window. You can now perform any of the following tasks:
209+
The dataset that you created is available in the **Data Sources** window. You can now perform any of the following tasks:
210210

211211
- Select items in the **Data Sources** window and drag them onto your form or design surface (see [Bind Windows Forms controls to data in Visual Studio](../data-tools/bind-windows-forms-controls-to-data-in-visual-studio.md) or [WPF data binding overview](/dotnet/desktop-wpf/data/data-binding-overview)).
212212

0 commit comments

Comments
 (0)