使用DataGridView绑定导航器 [英] Using the DataGridView Binding Navigator

查看:98
本文介绍了使用DataGridView绑定导航器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用SQL Server Express数据库在Visual Basic 2008中开发应用程序.我的表单有一个DataGridView,它由一个工作正常的查询填充. DataGridView完全按照我的要求显示.

I have am working on an application in Visual Basic 2008 using an SQL Server Express database. My form has a DataGridView which is populated by a query which works fine. The DataGridView displays exactly as I want it.

但是,我添加新记录的努力全部失败了.我对三件事感到困惑,没有任何文档或其他文章可以帮助澄清问题.这是我的担忧:

However, my efforts to add a new record have all failed. I'm confused about three things and none of the documentation or other articles help clarify the issue. Here are my concerns:

我使用的是查询,而不是表格作为源吗?

Is my use of a query, rather then the table as a source a problem?

是否需要使用特定的属性? "EditMode"物业供应让我感到困惑的替代方案.

Is there a specific property or properties that I need to use? The "EditMode" property supplies alternatives that have me confused.

"AddNew"菜单项使我感到困惑,您使用它来开始或结束输入吗?

The "AddNew" menu item confuses me, do you use it to start or end your entry?

感谢您的帮助.

Milt

sirmilt

推荐答案

Milt,

有很多方法可以设置"DataSource". DataGridView的视图.您可以使用DataReader,DataSet,Linq查询,实体(EF),....请解释查询"的含义.

There are many ways to setup the "DataSource" of a DataGridView. You can use a DataReader, a DataSet, a Linq Query, an Entity (EF),.... Please explain what you mean by a "query".

在任何情况下,您都应该能够更新数据,但是它永远不会自动进行.您始终必须将更新编码回数据库.并且语法会根据您选择的数据访问技术而有所不同.

In any case, you should be able to update the data, but it is never automatic. You always have to code the update back to the database. And the syntax varies depending on the data acces technique that you chose.

EditMode属性仅定义将在单元格中开始编辑数据的动作.在某些情况下,您想在打"enter"时开始编辑.在其他情况下,您想使用F2 ...与插入新行无关.

The EditMode property simply defines what action will start editing data in a cell. There are situations when you want start editing upon hitting "enter". In other cases, you want to use F2... This has nothing to do with inserting a new row.

要插入新行,可以使用datagridview的最后一行(带有星号).您也可以使用BindingNavigator.或使用特定的表格...

To insert a new row, you can use the last line of the datagridview (with an asterisk). You may also use the BindingNavigator. Or use a specific form...

AddNew项允许您在允许用户输入/修改数据之前对操作进行编码.

The AddNew item allows you to code the actions before allowing the user to enter/modify data.

通常,围绕一些代码提出问题会更有效...

Generally, it is more efficient to ask a question around some code...


这篇关于使用DataGridView绑定导航器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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