I have found several asp.net logon cases on the Internet over the past few days. I want to study the code.
An error message is displayed when a database file is attached to SQL Server2005, as shown in the following figure:
For a moment, Baidu Google turned to Baidu for help. After a variety of experiments, we sorted out the solutions here, hoping to help you. If you have any good comments, you can exchange more!
Solution 1: switch the logon mode
This is caused by the use of "hybrid authentication" (SQL Server Authentication) to log on to the database. You only need to change the logon mode to "windows authentication mode"
You can solve this problem by logging on to the console. After The append is successfully attached, you can use the hybrid authentication mode to log on.
This method has been tested by myself.
Solution 2: modify the service
Select all programs-SQL Server 2005-Configuration tools-select "SQL Server Configuration Manager" or "SQL Server Configuration Manager ",
Open the "SQL Server Configuration Manager" Configuration interface, select "SQL Server 2005 service" on the left, right-click on the right to open the "SQL Server (SQLEXPRESS)" attribute, change the Network Service-"Network Service" in the built-in account to the Local System-"Local System ",
Click "restart" and then attach the database.
This method has been tested by myself.
If you are worried about changing the settings after attaching the database, you can use the "Local System" in the built-in account before changing it back.
"Network Service", the database can still be opened.
The main configuration process is as follows:
1. Open the "SQL Server Configuration Manager" Configuration page:
2. Select sq( SQLEXPRESS), and right-click:
3. Select "Local System ":
4. Select "restart ":
5. Configuration successful:
In this way, no errors will occur when you attach the database after the configuration.
Problems:
Some people on the Internet say that the database file can be copied to other folders and attached to the attachment, but this method is not valid after my test.
Solutions to read-only Database attributes discovered after attaching a database
After attaching the database, you can find that the database attribute is "read-only". Solution:
Open "SQL Server 2005", right-click the read-only Database, select Properties, select "options" under "select page" on the left of the properties window, and set "database as read-only" on the right of the window.
Change to "False" and click "OK.
Cause: The attached database is "read-only" because the default startup account "network service" of SQL Server is used to start the Attach database file.
The permission is insufficient. This method has been tested by myself.
The main configuration process is shown in the figure:
Step 1:
Step 2: