在许多文本框中显示文本 [英] display colunm in to many text box
本文介绍了在许多文本框中显示文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图在文本框中显示表列.
所以请告诉我你在做什么?
我的代码是:
i m trying to display table colunm in textbox.
so plz tell me what r u doing?
my code is :
con.Open();
SqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "select * from menumaster";
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
SqlDataAdapter da = new SqlDataAdapter(cmd);
da.Fill(dt);
forech(datarow dr in dt.rows)
{
}
您将在forech循环中写些什么..
我尝试显示menuname(这是我的会议名称),并在该会议中显示20条记录.
我尝试在20个文本框中显示20条记录..
提前谢谢...
what will u write in forech loop..
i try to disply menuname(this is my colunm name) and in this colunm 20 records .
i m try disply 20 record in 20 textbox..
advance Thanks...
推荐答案
奇怪的要求,但是,请尝试:
Strange requirement, yet, try:
forech(datarow dr in dt.rows)
{
// rough pseudo code to add textbox for each table row-menuname in a given panel
TextBox t = new TextBox();
t.Text = dr["menuname"].ToString();
somePanel.Add(t);
}
这篇关于在许多文本框中显示文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文