Search code examples
asp.net-mvc-2oledbsql-server-expressaspnetdb

aspnetdb.mdf and Microsoft.ACE.OLEDB.12.0


I'm trying to run my asp.net application on a windows machine (XP SP3, Vista, 7) which has only Microsoft.ACE.OLEDB.12.0 as the database engine installed and need to connect to the standard aspnetdb.mdf user database.

Does any one know it is possible to use a connection string that works with mdf files in such a condition? I used connection strings like this but no success yet:

connectionString = "provider=Microsoft.ACE.OLEDB.12.0;Data Source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true";

Thanks


Solution

  • Try one like this:

    Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\aspnetdb.accdb;Persist Security Info=False;
    

    For more connectionstrings, go to http://www.connectionstrings.com/access-2007

    EDIT: It's not possible to connect to a Sql Server database using OleDB. Install SQL Server (Express) instead.