0

I have a C# application which accesses a local auto-named database like DB_Users.mdf to pull out user connection details.

My connection string is:

 Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\DB_Users.mdf;Integrated Security=True

When I deploy this application on a laptop, I get an error like this

The database"C:\ProgramFiles(x86)\ISTL\PCArchieSetup|DB_USEr.MDF" can't be opened because itis version 852 ,the Server support version 782 and earlier.Couldn't open new database "C:\programfiles\IstL\PcArchie\DB_users.mdf"Create database is aborted.An attempt to attach an auto-named database for file "C:\programfiles\IstL\PcArchie\DB_users.mdf" failed. A database with the same name exist or specific file cannot be opened on UNC share

Initially, I thought this VS version problem. So I updated to VS community 2015. But still getting the same error. I suspect the file location it's trying to access is the problem. But don't know how to resolve it. Can you share your thoughts on this? Thanks in advance for your help.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
  • The `.mdf` file you have is from a SQL Server **2016** instance (version 852), but on that laptop, you have SQL Server **2014** (version 782) and that won't work - you can ***never*** open/restore/attach a database from a more recent version to an older version of SQL Server – marc_s May 19 '17 at 10:43
  • http://stackoverflow.com/questions/26346647/the-database-cannot-be-opened-because-it-is-version-782-this-server-supports-ve – Steve May 19 '17 at 10:43
  • @marc .By loading SQL server 2016 on laptop will fix this error? When deploying the app on laptop,how does it get access to C:\programfiles\IstL\PcArchie\DB_users.mdf"? – user7274707 May 19 '17 at 10:59
  • You'll need to deploy SQL Server 2016 **Express** to the laptop - either by replacing the SQL Server 2014 installation, or by installing side-by-side. And then you need to make sure you're referencing the correct, 2016 instance in your connection string – marc_s May 19 '17 at 11:33

0 Answers0