I have restricted access to SQL server database & I have to alter table from my MVC project. I have tried:
var db = MyDbContext.Create();
try
{
var res =
db.Speakers.SqlQuery("ALTER TABLE [dbo].[Speakers] ADD [LastName] [nvarchar](256) NULL");
}
catch (Exception exception)
{
Console.WriteLine(exception);
}
its not throwing exception but not updating table. I have no idea whether Raw query allow alteration or not. But I just gave a try. Can any one tell how can I alter database?