且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将WinForms DataGridView控件绑定到SQL Server数据库

更新时间:2022-10-15 08:08:56

对表格的控制。然后单击DataGridView右上角的小箭头打开一个菜单。选择选择您的源,然后选择您的数据库或数据集。然后在同一菜单上,您可以选择是否启用列的添加,编辑,删除或重新排序。


I am a .NET noob who is trying for figure out how to bind a grid control to a SQL Server database so that when rows are inserted, updated or deleted from the grid, they are also inserted, updated or deleted from the database. C#, .NET 3.5, VS2008 SP1

Warren

Drag the control on the form. Then click the small arrow at the top right corner of the DataGridView to open up a menu. Select Choose your source, and select your database or dataset. Then on the same menu, you can choose whether to enable Adding, Edit, Deleting, or Reordering of columns.