locked
connection string for imported access database file RRS feed

  • Question

  • User-35134078 posted

    Good day everybody

    I am using Microsoft Visual Studio 2013, office 2013 & Windows 8

    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 

    This is what I have written

    string CS = "Provider=Microsoft.ACE.OLEDB.12.0; database= db1.mdb";

    but when I run it, I receive the following error:

    "Could not find installable ISAM"

     

    CAN ANYBODY HELP ME AS SOON AS POSSIBLE

    Tuesday, April 15, 2014 5:01 PM

Answers

  • User-1199946673 posted

    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 connectionstring, 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

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 16, 2014 2:56 AM

All replies

  • User-1716253493 posted

    try using full path instead

    Tuesday, April 15, 2014 8:36 PM
  • User-1199946673 posted

    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 connectionstring, 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

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Wednesday, April 16, 2014 2:56 AM
  • User1918509225 posted

    Hi albasel,

     About your problem,Here are my suggestion:

    Image  that if you have a folder Name ”Db” ,and have a access database named “xx.mdb” in your project.

    You can try the string like below:

    string conn=”Provider=Microsoft.ACE.OLEDB.12.0; ”+”Data Source=”+Server.MapPath(“Db/xx.mdb”);

     More details about how to use an Access Database with ADO.NET ,please refer to the link below:

    http://msdn.microsoft.com/en-US/us-en/library/ms971485.aspx

     

    Hope it can help you.

    Best Regards,

    Kevin Shen.

    Wednesday, April 16, 2014 5:33 AM
  • User-1199946673 posted

    Image  that if you have a folder Name ”Db” ,and have a access database named “xx.mdb” in your project.

    Note that the database is NOT protected form being downloaded directly. That's why you better store the database in the App_Data folder....

    More details about how to use an Access Database with ADO.NET ,please refer to the link below:

    http://msdn.microsoft.com/en-US/us-en/library/ms971485.aspx

    The examples used in this article are really bad. By concatenate the commandtext, it's vulnarable to SQL injections....

    http://www.mikesdotnetting.com/Article/26/Parameter-Queries-in-ASP.NET-with-MS-Access

    Wednesday, April 16, 2014 6:13 AM
  • User-35134078 posted

    Provider=Microsoft.ACE.OleDb.12.0;Data Source=|DataDirectory|db1.mdb

    I works with me

    Thank you hans_v and thanks for all

    Saturday, April 19, 2014 3:07 PM