Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Express Edition and Compact Edition (2005)
 Sql Server Express Connectivity from c#

Author  Topic 

dushafer
Starting Member

1 Post

Posted - 2006-08-16 : 12:15:48
I have written a c# app that access a sql server express db. When I use windows integrated authentication, I can run the program just fine as my windows user has sysadmin rights. I have created a "toned down" user specifically for this app and given it the appropirate privalleges. When I run the program and try to connect as this user, I get the following error:

CREATE DATABASE permission denied in database 'master'
Could not attach file 'd:\\data\\sqlexpress\\Security.mdf' as database 'Security'

Here is my Sql connection:
<add name="Security"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename="d:\data\sqlexpress\Security.mdf";Database=Security;Initial Catalog=Security;uid=welduser;password=welduser;User Instance=false"
providerName="System.Data.SqlClient" />

Also, if I add the welduser login to the 'dbcreator' role it works fine. I shouldn't have to allow this user to be able to create databases. Any idea what's going on?
   

- Advertisement -