如何在c#中获取数据表的第一个Cell值 [英] how to get the first Cell value of the data table in c#

查看:313
本文介绍了如何在c#中获取数据表的第一个Cell值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嘿,

i有数据表

i想得到第一个Cell的值(行:1列:1)

然后将此值保存到字符串变量

请帮助我

解决方案

只需这样做:



 string result = dataTable.Rows [0] [0] .ToString(); 





这应该可以解决问题!


hey ,,
i have a data table
i want to get the value of the first Cell ( row :1 column : 1)
and then save this value to the string variable
pls help me

解决方案

Just do this:

string result = dataTable.Rows[0][0].ToString();



That should do the trick!


这篇关于如何在c#中获取数据表的第一个Cell值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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