PC Review


Reply
Thread Tools Rate Thread

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

 
 
R.A.M.
Guest
Posts: n/a
 
      16th Dec 2006
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" />


 
Reply With Quote
 
 
 
 
Miha Markic [MVP C#]
Guest
Posts: n/a
 
      16th Dec 2006
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." <(E-Mail Removed)> wrote in message
news:em0ao9$nu0$(E-Mail Removed)...
> 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" />
>


 
Reply With Quote
 
R.A.M.
Guest
Posts: n/a
 
      16th Dec 2006
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 [MVP C#]" <miha at rthand com> napisał w wiadomości
news:%(E-Mail Removed)...
> 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." <(E-Mail Removed)> wrote in message
> news:em0ao9$nu0$(E-Mail Removed)...
>> 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" />
>>

>



 
Reply With Quote
 
Jesús López
Guest
Posts: n/a
 
      17th Dec 2006
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." <(E-Mail Removed)> escribió en el mensaje
news:em0ncv$orp$(E-Mail Removed)...
> 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 [MVP C#]" <miha at rthand com> napisał w
> wiadomości news:%(E-Mail Removed)...
>> 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." <(E-Mail Removed)> wrote in message
>> news:em0ao9$nu0$(E-Mail Removed)...
>>> 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" />
>>>

>>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
System.Data.SqlClient.SqlException: An attempt to attach an auto-named database for file "Location" failed. A database with the same name exists, or specified file cannot be opened, or it is located on UNC share. weird0 Microsoft C# .NET 1 20th Apr 2007 10:04 AM
CREATE DATABASE permission denied in database 'master'. ravi.govindaraju@gmail.com Microsoft ASP .NET 0 5th Apr 2007 05:10 PM
Any solution for error message "Could not attach file 'App_Data\Database.mdf' as database 'Database'."? ornit_sagy@yahoo.com Microsoft ADO .NET 0 8th Jan 2007 08:34 PM
Any solution for error message "Could not attach file'App_Data\Database.mdf' as database 'Database'."? ornit_sagy@yahoo.com Microsoft ADO .NET 1 8th Jan 2007 08:12 PM
CREATE DATABASE permission denied in database 'master' casper Microsoft ASP .NET 0 24th Apr 2006 03:41 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:42 AM.