---
title: "How to define connection string for MS  Access files."  
description: "How to define connection string for MS  Access files."  
author: "Manoj Bhatt"  
published: 2016-01-12  
updated: 2016-01-12  
canonical: https://www.mindstick.com/forum/33864/how-to-define-connection-string-for-ms-access-files  
category: "c#"  
tags: ["c#", ".net", "database connection"]  
reading_time: 1 minute  

---

# How to define connection string for MS  Access files.

Good day everybody\
I am using [Microsoft](https://www.mindstick.com/articles/12301/microsoft-is-trying-to-kill-passwords) [Visual Studio](https://www.mindstick.com/articles/12378/visual-studio-for-mac-is-out-of-beta-preview-now-officially-available) 2012 & [Windows](https://www.mindstick.com/articles/311752/how-to-install-and-use-the-google-wifi-software-on-a-windows-or-mac-computer) 8.1. I have imported [access](https://www.mindstick.com/articles/12994/how-foreigners-can-access-blocked-websites-in-china) [file](https://www.mindstick.com/articles/59/encrypting-and-decrypting-files-using-c-sharp) to Visual Studio by add Connection.I want to make a connection to that file and display one of the [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) in a Web Form.What should I write in the [connection string](https://www.mindstick.com/articles/328/connection-strings).\
CAN ANYBODY HELP ME AS SOON AS POSSIBLE .

## Replies

### Reply by Anupam Mishra

The best place to store the database is in the App_Data folder. In you placed it there, you can use the DataDrectory Directive, otherwise you need to use the full path. Also, instead of using the "database" keyword in the [connection](https://www.mindstick.com/articles/13012/what-makes-ethernet-connection-better-than-wifi) string, it should be "data source" Provider=Microsoft.ACE.OleDb.12.0;Data Source=|DataDirectory|db1.mdbAlso, when using an mdb file, you might as well use the OleDb 4.0 provider, which is installed on all Windows Servers Provider=Microsoft.Jet.OleDb.4.0;Data Source=|DataDirectory|db1.mdb. Here 'db1.mdb' is your access file.\


---

Original Source: https://www.mindstick.com/forum/33864/how-to-define-connection-string-for-ms-access-files

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
