I am trying to programmatically drop a column in a table inside of an access database and found myself unable to do so! Is it at all possible? it makes me think that i don't have any clear idea of things linq to sql can't do. Any ideas?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
There's nothing in LINQ to SQL that allows you to do that without writing T-SQL, no.
Similarly, you can't do straight updates or deletes without selecting the data you want to alter first and manipulating the objects. You'd have to write stored procedures for those things and add them to your model to be called. See this MSDN page for an overview.
Using DataContext.ExecuteQuery should also work if you don't mind T-SQL in your source code.
回答2:
You can do it. Here's an example:
ALTER TABLE Import
Alter column [Tot_Val] DECIMAL(10,2) ;
GO