CREATE DATABASE permission denied in database 'master'
-
Hi, I'm using Visual Studio 2008 and SQLExpress 2005.My OS system is win XP.I want to access my database from
"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Coupon Management.mdf"
.I am confused that it attacg database from App_data.When i run my program it show error CREATE DATABASE permission denied in database 'master'. Cannot attach the file 'C:\Inetpub\wwwroot\WebSite2\App_Data\Coupon Management.mdf' as database 'Coupon Management'. here is my connection string
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Coupon Management.mdf;Database=Coupon Management;
Trusted_Connection=Yes;Persist Security Info=True;Integrated Security=False
Plz help. thnx in advance
-
Hi, I'm using Visual Studio 2008 and SQLExpress 2005.My OS system is win XP.I want to access my database from
"C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\Coupon Management.mdf"
.I am confused that it attacg database from App_data.When i run my program it show error CREATE DATABASE permission denied in database 'master'. Cannot attach the file 'C:\Inetpub\wwwroot\WebSite2\App_Data\Coupon Management.mdf' as database 'Coupon Management'. here is my connection string
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Coupon Management.mdf;Database=Coupon Management;
Trusted_Connection=Yes;Persist Security Info=True;Integrated Security=False
Plz help. thnx in advance
"|DataDirectory|" is a substitution string that represents where the database file is stored. To set where |DataDirectory| resolves to, you have to call the AppDomain.SetData method. If you don't set the DataDirectory property, |DataDirectory| will default to App_Data for a web application or the "Application Data" folder (I think) for a winforms app. If you're having trouble getting your connection string working correctly, this website[^] can be quite useful. Hope that helps.