I'm trying to create a database by remote connecting to a SQL Server Express using Visual Studio 2008. I log onto SQL Server using SQL Authentication. I can do that remotely using SQL Server Management Studio Express no problem by using the following command:
CREATE DATABASE dbname ON (NAME='dbname_dat', FILENAME='C:\folder\dbname.mdf') LOG ON (NAME='dbname_log', FILENAME='C:\folder\dbname.ldf')
However, when I use the same line in my code, I get the following error:
CREATE DATABASE permission denied in database 'master'.
Error number is 262 and class number is 14. My connection string is:
server=servername;database=master;trusted_connection=yes;Pooling=false;
Can anyone help?