An exception occurred when creating a database (Microsoft. SqlServer. Smo) and executing a Transact-SQL statement or batch processing. (Microsoft. SqlServer. ConnectionInfo, transactsql
The Charging System of the IDC is complete, but I knocked it on my laptop and didn't implement remote release. The result was only a PASS ~ Back to re export your database to the desktop, because my laptop installed SQL and desktop version is not the same, so encountered some problems, specific solution please refer to blog: http://blog.csdn.net/mascf/article/details/38644759
The script is exported successfully, but a problem occurs when you create a database. The following problems occur during the creation process:
(But I forget the keyword is as follows)
Failed to create database (Microsoft. SqlServer. Smo ))
An exception occurred when executing a Transact-SQL statement or batch processing. (Microsoft. SqlServer. ConnectionInfo)
Unable to obtain the exclusive lock on the database 'model'
This phenomenon is caused by deadlocks.
Solution: Find the process id that occupies the model database and kill the process to get the resource.
The procedure is as follows:
Run the following code in the query Analyzer:
<span style="font-size:18px;">declare @sql varchar(100)
while 1=1
begin
select top 1 @sql = 'kill '+cast(spid asvarchar(3))
from master..sysprocesses
where spid > 50 and spid <> @@spid
if @@rowcount = 0
break
exec(@sql)
end</span>
Then you can create a new database. The re-generated database contains no content. We need to add an administrator to create a new query:
<Span style = "font-size: 18px;"> insert into user_info (userID, PWD, Level, UserName, Head) values ('1', '1', 'admin ', 'xu fengzhu ', 'admin') </span>
Now, let's test it on the desktop!
An exception occurred when executing the Transact-SQL statement or batch processing (MicrosoftSqlServerConnectionInfo)
1. An error occurred while attaching the database to the server F-PC.
Check whether the server name is incorrect, whether the server allows modification, and whether the database file version is incorrect !!
2. An exception occurred when executing a Transact-SQL statement or batch processing. (Microsoft. SqlServer. ConnectionInfo)
This must be because the SQL statement is incorrect or the database is incorrect !!
3. The physical file "E: \ Student_Data.MDF" cannot be opened ". Operating System Error 5: "5 (Access denied .) ". (Microsoft SQL Server, error: 5120)
This database is used by LZ now. You have to shut down the service. If not, read the file only !!!
An error occurred when creating a user in SQL. How can this problem be solved? An exception occurred when executing a Transact-SQL statement or batch processing.
Is it about table creation or database user login?
If the user wants to log on to the account, he must log on to the account. Otherwise, he cannot log on to the account after the account is created.
Remote users must be allowed to log on remotely. Otherwise,
Create a number. Do not use special characters unless specified.
I don't know anything else...