将DataGridView绑定到sql视图,并进行更新
我希望能够将 datagridview 绑定到 sql 视图,并使用内置的 tableadapter 更新方法将数据写回视图。这可能吗?
谢谢。
I'd like to be able to bind a datagridview to a sql view and use the built in tableadapter update method to write data back to the view. Is this possible?
Thank you.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
是的,但它有局限性。
http://msdn.microsoft.com/en- us/library/aa933206(v=sql.80).aspx
另外:
“Microsoft SQL Server 不允许更新 SQL 视图中使用的多个数据库表中的字段。根据 Microsoft 的说法, “INSERT、UPDATE 和 DELETE 语句还必须满足某些条件,然后才能引用可更新的视图……仅当视图可更新并且编写 UPDATE 或 INSERT 语句以便修改数据时,UPDATE 和 INSERT 语句才能引用视图仅在视图的 FROM 子句中引用的基表之一中,仅当视图在其 FROM 子句中引用了一个表时,DELETE 语句才能引用可更新视图。”
yes but it comes with limitations.
http://msdn.microsoft.com/en-us/library/aa933206(v=sql.80).aspx
Also:
"Microsoft SQL Server does not permit updating fields in multiple database tables used within a SQL view. According to Microsoft, “INSERT, UPDATE, and DELETE statements also must meet certain qualifications before they can reference a view that is updatable… UPDATE and INSERT statements can reference a view only if the view is updatable and the UPDATE or INSERT statement is written so that it modifies data in only one of the base tables referenced in the FROM clause of the view. A DELETE statement can reference an updatable view only if the view references exactly one table in its FROM clause."