Home > Article > Backend Development > SQL Server Express database automatic deployment problems and solutions_PHP tutorial
I have made a program in the past few days, VS 2005 SQL Server Express. After carefully reviewing the documentation, I found that SQL Server Express supports the XCOPY deployment method. That is to say, as long as the target computer has SQL Server Express, you only need to copy the database and you can In the same directory as the program, then configure the AttachDBFileName parameter in the connection string. The database will be automatically connected to SQL Server Express and will be automatically deattched after running. It felt good, and I copied the tiger like a cat, but an error occurred: "The database has been compressed and cannot be created. It needs to be decompressed." Wow, when did it become compressed? Could it be Shinrk's problem? After working on it for n hours, with no solution, I went to sleep.
I will fight again the next day, but I can’t find any solution after searching the information and the Internet. I want to give up, but I can’t. I accidentally discovered that the Attach database in the management interface also had this error, but the database in the original directory was fine. An error will occur when copying the database to the program directory (on the D: drive, SQL Server Express is installed on the C: drive). Isn't that the problem?
I moved the program directory to the C drive, everything was normal, and then I completely fainted. Does the automatically attached database have to be on the C drive? ? ?
In addition, if the database file is set to read-only, it can be mounted no matter which disk it is on, but it will become a read-only database.
Although the problem has been solved, I don’t understand the principle. Is it a bug or a problem with my system?
In fact, Sybase's SQL Anywhere is really good. The database management system is started only when the database is started. When the system is finished, the database management system automatically ends. It would be great if SQL Server Express also supports this function. I don't like not to use it. There is also a SQL Server service running on the database. Access doesn’t even support stored procedures. Microsoft, it’s not easy to say I love you.
BLOG:ZhangJinglin