如何使用数据读取器和数据表分配特定的列值? [英] how to assign a particular column values retrieve using data reader and data table ?
本文介绍了如何使用数据读取器和数据表分配特定的列值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在为所有文本框提供数据的价值,例如
i am assing value of data tabe to all textboxes like
if (dr.HasRows)
{
if (dr.Read())
{
if (dt.Rows[0][0].ToString() == String.Empty)
{
textBox1.Text = null;
}
else
{
textBox1.Text = dt.Rows[0][0].ToString();
}
if (dt.Rows[1][0].ToString() == String.Empty)
{
textBox2.Text = null;
}
else
{
textBox2.Text = dt.Rows[1][0].ToString();
}
if (dt.Rows[2][0].ToString() == String.Empty)
{
textBox3.Text = null;
}
else
{etc.
in database there is only two row in column
and show error on third
i just want to compare bland or null value an d i don't know how to do this
推荐答案
这篇关于如何使用数据读取器和数据表分配特定的列值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文