I have created a setup application with SQLEXpress 2008 as a prerequisite. On test SQLExpress installs OK
after the application is installed it must create and install a database using a mixture of SMO and Scripting. I used SMO to add the current user (who is a Windows Administrator) as a Login to the SQL Express server.
Dim l As Login = New Login(srv, My.User.Name)
l.LoginType = LoginType.WindowsUser
l.AddToRole("sysadmin")
l.DefaultDatabase = "MASTER"
l.Create()
It fails on srv.CreateDatabase with error message "permission denied in database MASTER"
this thread talks about converting the server to single user mode before adding a login
http://social.msdn.microsoft.com/Forums/en-US/sqlexpress/thread/86daf5f5-d333-40b1-ae6f-0da052a96600
how is it possible to scrip this? there is no&nbs
View Complete Post