I am asp mvc 3 noobie. I have done some tutorials and am now ready to continue learning while trying to create a site.
In all tutorials, you connect to the SQL CE or SQL Express database. But I want my site to create a database on the sql server.
I created a database on my network server, which I will call MyDB. Then I installed the connection string in my web configuration file as follows:
add name="ApplicationServices" connectionString="Data Source=Server\ServerInstance;Initial Catalog=MyDB;Integrated Security=True" providerName="System.Data.SqlClient"
I created models and a forest controller.
I created a simple DataBaseContext as follows:
Imports System.Data.Entity Public Class DatabaseContext Inherits DbContext Public Property Employee As DbSet(Of Employee) Public Property AnnualLeave As DbSet(Of AnnualLeave) End Class
But when I find the following line in the forest controller, I get an error:
Function Index() As ViewResult Return View(db.Employee.ToList()) //CREATE DATABASE permission denied in database 'master'`. End Function
- Should I fix this by changing permissions in the MyDB database? Is this a problem with SQL Server permissions? I am confused why I am getting a database creation error because the database already exists.
- I get this b / c error Have I already created the database? Are scaffolding somehow creating a database?
source share