DataTable问题,关于取出字段. [英] DataTable problem, about taking field out.
本文介绍了DataTable问题,关于取出字段.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
SqlCommand cmd = new SqlCommand("SELECT * FROM [t_memsch] where [m_memcode]='" + m_memcode_input.Text + "'", conn);
SqlDataAdapter sda1 = new SqlDataAdapter(cmd);
DataTable ds1 = new DataTable();
sda1.Fill(ds1);
try
{
//int temp = ds1.Rows.Count
for (int temp = ds1.Rows.Count; temp > 0; temp--)
{
chk_date(ds1.["m_cname"].ToString());
//Console.Write("Temp:", temp);
//MessageBox.Show("i m here");
}
}
在DataTable中有一列m_cname,我如何取出它并将其传递给函数chk_date?请大家帮忙.
Hi there, there is a column m_cname in the DataTable, how can i take it out and pass it to the function chk_date? please everyone help.
thanks a lots.
推荐答案
试试以下
Hi,
Try the following
try
{
//int temp = ds1.Rows.Count
for (int temp = ds1.Rows.Count; temp > 0; temp--)
{
chk_date(ds1.Rows[temp]["m_cname"].ToString());
//Console.Write("Temp:", temp);
//MessageBox.Show("i m here");
}
}
希望对您有所帮助.
Hope this helps.
使用此
use this
ds1.Rows[temp]["m_cname"].ToString();
请参阅此博客
http://www.dotnetfunda.com/articles/article131.aspx [
see this blog
http://www.dotnetfunda.com/articles/article131.aspx[^]
--NDK
这篇关于DataTable问题,关于取出字段.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文