我可以向datagridview控件添加一个带有值的新行吗 [英] can i add a new row with values to datagridview control

查看:63
本文介绍了我可以向datagridview控件添加一个带有值的新行吗的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想向datagrid添加新行,并将同一行添加到数据库.
万一发生这种情况,我应该编写代码.possibilties

i want to add new row to datagrid and the same will be added to database.
in whice event i shouild write .what r the code possibilties

推荐答案

是的.只需创建一个新行,如
DataRow行= mydataset.NewRow();

并为该行分配值.
mydataset.acceptchanges();
并全部完成.
Yes you can. Simple create a new row like
DataRow row = mydataset.NewRow();

and assign values to this row.
mydataset.acceptchanges();
and all done.


错误的问题.哪种数据库?什么样的数据?通过代码或用户界面添加行?到目前为止你有什么?您在使用绑定吗?您在使用任何ORM工具吗?您在说什么控件的事件?您期望什么答案.如果您不知道想要什么,那我们应该怎么办?
您可以首先使用Google搜索 DataGridView [ DbConnection [ DbCommand [ DbDataAdapter [ ^ ], DbTransaction [ ^ ].或者实体框架 [ nHibernate [ ^ ]还可以喝杯茶吗?
Bad question. Which kind of database? What kind of data? Add row through code or UI? What do you have so far? Are you using binding? Are you using any ORM tools? What Events of what Controls are you talking about? What answer do you expect. If you do not know what you want then how should we?
You can start by Googling DataGridView[^] and stuff like DbConnection[^], DbCommand[^], DbDataAdapter[^], DbDataReader [^]and DbTransaction[^]. Or maybe the Entity Framework[^] or nHibernate[^] are more your cup of tea?


这篇关于我可以向datagridview控件添加一个带有值的新行吗的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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