如何将WinForms DataGridView控件绑定到SQL Server数据库 [英] How do I bind a WinForms DataGridView control to a SQL Server database

查看:175
本文介绍了如何将WinForms DataGridView控件绑定到SQL Server数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是一个.NET noob,他正在试图找出如何将网格控件绑定到SQL Server数据库,以便当从网格插入,更新或删除行时,它们也会从网格中插入,更新或删除数据库。 C#,.NET 3.5,VS2008 SP1



Warren

解决方案

对表格的控制。然后单击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.

这篇关于如何将WinForms DataGridView控件绑定到SQL Server数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆