How to define connection string for MS Access files.

Total Post:154

Points:1086

C#
 799  View(s)
Ratings:
Rate this:
Good day everybody

I am using Microsoft Visual Studio 2012 &  Windows 8.1. I have imported access file to Visual Studio by add Connection.
I want to make a connection to that file and display one of the table in a Web Form.
What should I write in the connection string.
CAN ANYBODY HELP ME AS SOON AS POSSIBLE .
  1. Re: How to define connection string for MS Access files.

    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 string, it should be "data source" Provider=Microsoft.ACE.OleDb.12.0;Data Source=|DataDirectory|db1.mdb
    Also, 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.

      Modified On Apr-10-2018 11:40:35 PM

Answer

Please check, If you want to make this post sponsored

You are not a Sponsored Member. Click Here to Subscribe the Membership.