"CREATE DATABASE permission denied in database 'master'. Could not attach file..."

R

R.A.M.

Hello,
I am learning .NET 3.0. I am writing application using MIMProjekty SQL
Server 2005 database.
At C# command (identifiers are in Polish language):
SqlConnection Po³±czenie = new
SqlConnection(ConfigurationManager.ConnectionStrings["MIMProjekty"].ConnectionString);

Po³±czenie.Open();

I receive the following error:

CREATE DATABASE permission denied in database 'master'.
Could not attach file
'E:\Inetpub\wwwroot\MIMProjekty\App_Data\MIMProjekty.mdf' as database
'MIMProjekty'.

Could you help me please? The error is strange for me.
I use mixed mode in my SQL Server 2005 Express Edition. The database
'MIMProjekty' looks fine in Management Studio Express.

Here's my connection string from web.config:

<add name="MIMProjekty" connectionString="Data
Source=.\SQLEXPRESS;AttachDBFileName=|DataDirectory|\MIMProjekty.mdf;Initial
Catalog=MIMProjekty;Integrated Security=True;uid=sa;pwd=sqlserver"
providerName="System.Data.SqlClient" />
 
M

Miha Markic [MVP C#]

Hi,

First, thanks for sharing admin password, appreciated ;-)
Other than that, try switching off Integrated Security (it uses asp.net
account right now, not the credentials provided).
 
R

R.A.M.

Thanks.
After I switched off Integrated Security I have error:

Database 'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\MIMProjekty.mdf' already exists.
Could not attach file
'E:\Inetpub\wwwroot\MIMProjekty\App_Data\MIMProjekty.mdf' as database
'MIMProjekty'.

I have MIMProjekty attached in Management Studio. Why ADO.NET tries to
attach it again?
How to solve the problem?
Please help.
Thank you.
/RAM/

U¿ytkownik "Miha Markic said:
Hi,

First, thanks for sharing admin password, appreciated ;-)
Other than that, try switching off Integrated Security (it uses asp.net
account right now, not the credentials provided).

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

R.A.M. said:
Hello,
I am learning .NET 3.0. I am writing application using MIMProjekty SQL
Server 2005 database.
At C# command (identifiers are in Polish language):
SqlConnection Po³±czenie = new
SqlConnection(ConfigurationManager.ConnectionStrings["MIMProjekty"].ConnectionString);

Po³±czenie.Open();

I receive the following error:

CREATE DATABASE permission denied in database 'master'.
Could not attach file
'E:\Inetpub\wwwroot\MIMProjekty\App_Data\MIMProjekty.mdf' as database
'MIMProjekty'.

Could you help me please? The error is strange for me.
I use mixed mode in my SQL Server 2005 Express Edition. The database
'MIMProjekty' looks fine in Management Studio Express.

Here's my connection string from web.config:

<add name="MIMProjekty" connectionString="Data
Source=.\SQLEXPRESS;AttachDBFileName=|DataDirectory|\MIMProjekty.mdf;Initial
Catalog=MIMProjekty;Integrated Security=True;uid=sa;pwd=sqlserver"
providerName="System.Data.SqlClient" />
 
J

Jesús López

On Server Explorer, right click on the database and select detach. The
problem is likely due to the fact that the database is already attached, and
you are using different credentials to connect.

Regards:

Jesús López



R.A.M. said:
Thanks.
After I switched off Integrated Security I have error:

Database 'C:\Program Files\Microsoft SQL
Server\MSSQL.1\MSSQL\DATA\MIMProjekty.mdf' already exists.
Could not attach file
'E:\Inetpub\wwwroot\MIMProjekty\App_Data\MIMProjekty.mdf' as database
'MIMProjekty'.

I have MIMProjekty attached in Management Studio. Why ADO.NET tries to
attach it again?
How to solve the problem?
Please help.
Thank you.
/RAM/

U¿ytkownik "Miha Markic said:
Hi,

First, thanks for sharing admin password, appreciated ;-)
Other than that, try switching off Integrated Security (it uses asp.net
account right now, not the credentials provided).

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

R.A.M. said:
Hello,
I am learning .NET 3.0. I am writing application using MIMProjekty SQL
Server 2005 database.
At C# command (identifiers are in Polish language):
SqlConnection Po³±czenie = new
SqlConnection(ConfigurationManager.ConnectionStrings["MIMProjekty"].ConnectionString);

Po³±czenie.Open();

I receive the following error:

CREATE DATABASE permission denied in database 'master'.
Could not attach file
'E:\Inetpub\wwwroot\MIMProjekty\App_Data\MIMProjekty.mdf' as database
'MIMProjekty'.

Could you help me please? The error is strange for me.
I use mixed mode in my SQL Server 2005 Express Edition. The database
'MIMProjekty' looks fine in Management Studio Express.

Here's my connection string from web.config:

<add name="MIMProjekty" connectionString="Data
Source=.\SQLEXPRESS;AttachDBFileName=|DataDirectory|\MIMProjekty.mdf;Initial
Catalog=MIMProjekty;Integrated Security=True;uid=sa;pwd=sqlserver"
providerName="System.Data.SqlClient" />
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top