ASP.NET MVC 4 --c#を使用してライブデータベースに接続し、結果を一覧表示していますが、ページを表示すると、次のエラーが返されます。
CREATE TABLE permission denied in database 'DatabaseName'.
Description: An unhandled exception occurred during the execution
of the current web request. Please review the stack trace for more
information about the error and where it
originated in the code.
Exception Details: System.Data.SqlClient.SqlException: CREATE TABLE
permission denied in database 'DatabaseName'.
Source Error:
Line 16: public ActionResult Index()
Line 17: {
Line 18: return View(db.AccControls.ToList());
Line 19: }
Line 20
コントローラ:
namespace TestDBCon.Controllers
{
public class HomeController : Controller
{
private DataDbContext db = new DataDbContext();
public ActionResult Index()
{
return View(db.AccControls.ToList());
}
}
}
AccControl.cs(モデル)
namespace TestDBCon.Models
{
public class AccControl
{
public int ID { get; set; }
public int ControlCode { get; set; }
public string Nominal { get; set; }
public string CostCentre { get; set; }
public string Department { get; set; }
}
public class DataDbContext : DbContext
{
public DbSet<AccControl> AccControls { get; set; }
}
}
Web.Config:
<add name="DataDbContext" connectionString="Data Source=***;initial catalog=***;integrated security=True;" providerName="System.Data.SqlClient" />
テーブルを作成しようとはしていませんか?結果を一覧表示しようとしているだけなので、非常に混乱しています。それはMVCと関係があるに違いありませんか?
どんな助けでも大歓迎です!
ありがとう