更改 vb.net 数据表中列的值
我想循环访问数据表并更改该数据表中特定列的值。
例如:数据库返回Request_ID
、Desc
、Date
和Status_Ind
。 Status_Ind
列包含整数值。我不想向用户显示整数值。我想根据该列中返回的整数值将其转换为字符串值。
if Status_Ind = 1 then
'the values changes to Published
I want to loop through a databale and change the values of a specific column in that datatable.
eg: the database returns Request_ID
, Desc
, Date
and Status_Ind
. The Status_Ind
column contains integer values. I dont want to show the integer values to the user. I want to convert that to a string value based on the integer values returned in that columns.
if Status_Ind = 1 then
'the values changes to Published
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您的数据表定义如下:
首先,您需要向数据表添加一个新列来保存状态:
现在循环数据表并更新状态列:
然后您可以删除整数列:
Assuming your DataTable is defined as this:
First you need to add a new column to your DataTable to hold the Status:
Now Loop through the DataTable and update the status column:
Then you could then remove the integer column:
您可以通过创建另一列来做到这一点:
You could do it by creating another column: