Windows窗体中的Datagrid视图 [英] Datagrid view in windows form

查看:81
本文介绍了Windows窗体中的Datagrid视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以帮助我吗,
我需要将值从datagridview保存在数据库中,如果我在一行中给出该值,那么默认的空行也会到来.在循环条件下,我给出了Save,但该默认行也被占用,并且会发生错误.

can any one help me,
i need to save the value in database from datagridview,if i give the value in one row then default empty row also coming. In loop condition i gave Save but that default row also taken and error occurs.

推荐答案

可以通过DataSet和dataTableAdapter来完成,datagridview可以通过该方法绑定. >
终止您的数据适配器有插入/删除/更新的队列

按下一个按钮,然后单击该按钮
It can be done by DataSet and dataTableAdapter by which the datagridview bind.

Ckeck your dataadapter have queies of Insert/delete/update

Take a button and on click of this button
private void button2_Click(object sender, EventArgs e)
       {
           try
           {
               requesterTableAdapter.Update(requesterFileInventoryDataSet.Requester);
               MessageBox.Show("Record Updated", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
           }
           catch (Exception ex)
           {
               MessageBox.Show("Some Error in Update", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
           }

       }


这篇关于Windows窗体中的Datagrid视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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