Reputation: 197
How can I use my database file (.mdf
) created using SQL Server in 2012 in calling it from Visual Studio (as an instance)?
SqlConnection con = new SqlConnection("Data Source = .\\SQLEXPRESS; Initial Catalog = DB; Integrated Security = False; User ID = hi; Password=123");
That is the code to call it but only for SQL Server 2012. How to use it in SQL Server 2014? I kept on getting this error:
This database file is not compatible with the current instance of SQL Server.
To resolve this issue, you must upgrade the database file by creating a new data connection, or you must modify the existing connection to this database file.
Upvotes: 1
Views: 2283
Reputation: 725
Late the party, but I found this out. The upgrade isn't automatic. The key is to trigger it. Go to
`Data Connections -> Default Connection -> Right Click -> Modify connection -> Advanced -> Data Source`
Then there should be a pre-populated dropdown containing your instance.
ok -> ok
Then you'll get this screen. enter image description here
Default Connection Right Click -> refresh
Your db is enter image description here Your mdf is upgraded.
Upvotes: 1