I have a dictionary application that I wrote on my PC. I ran it on a laptop and everything works fine, I added words to the database.

After that, I copy the mdf and ldf files to my PC. I want to run my application and get an error: The prompt provider failed on Open Tell me, please, why is it happening? And how to overcome it?

Closed due to the fact that off-topic party PashaPash 8 Nov '17 at 20:41 .

It seems that this question does not correspond to the subject of the site. Those who voted to close it indicated the following reason:

  • “Questions asking for help with debugging (“ why does this code not work? ”) Should include the desired behavior, a specific problem or error, and a minimum code for playing it right in the question . Questions without an explicit description of the problem are useless for other visitors. See How to create minimal, self-sufficient and reproducible example . " - PashaPash
If the question can be reformulated according to the rules set out in the certificate , edit it .

  • Most likely, it’s about rights. MS SQL service works under some account - this user has no rights to the files you copied. - nzeemin 7:37 pm
  • How to fix it? - Vladimir
  • In Explorer, open the folder where these files are located, right-click on the file, properties, rights, change - for example, give rights to the user Everyone. - nzeemin

1 answer 1

We do not recommend migrating SQL Server databases as mdf and ldf files. Even worse, copy them from a running SQL Server.

The preferred option is to backup to one computer and then restore it to another.

If you still want to transfer files, you should follow this sequence:

  1. Disconnect the database on the machine from which you are copying files. If you simply copy, it is enough to transfer the database to OFFLINE, if you transfer it, you will disconnect the database (detach).
  2. Transfer files
  3. On the machine where you are transferring, you attach the database (attach).

It should be borne in mind that the version and release of SQL Server should not be lower than the one from which the files are copied, if the major version is lower, the database will not connect exactly, if the release is lower, it will not connect if there are objects in the database that are available only in more senior release.