使列可编辑表 [英] Make Column Editable Table

查看:89
本文介绍了使列可编辑表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,今天我有下一个问题:

我正在使用数据库进行连接,并使用DataGrid显示信息.

该控件还有其他控件可用于编辑加载的信息,但版本由行组成;我需要更改此设置,以用于专栏的版本.

谢谢!

Hello everyone, today I have the next problem:

I''m doing a conection with a database, and I show the info with a DataGrid.

This control has other control for edit the info loaded, but the edition makes of by rows; I need to change this, for do the edition for columns.

Thanks!

推荐答案

如果您的意思与以下类似:
If you mean something along the lines of:
UPDATE db SET col1 = 'someVal'


我将在DataGrid的上方或下方添加一行TextBox,当用户单击Enter或单击按钮时,将读取所有TextBox值,对其进行验证,然后编写动态SQL查询以手动更新数据.之后,重新加载DataGrid以显示更改.
这样,您可以进行任何类型的验证,并且可以完全控制哪些内容可以更新和不能更新.


I would add a row of TextBoxes above or below the DataGrid and when the user hits enter or clicks a button read all of the TextBox values, validate them, and then write a dynamic SQL query to manually update the data. After that reload the DataGrid to show the changes.
This way you can do any kind of validation, and you are in complete control of what can and can not be updated.


这篇关于使列可编辑表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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