本文介绍了如何从具有多个值的单列的数据库中填充texbox?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
你好......
i在mysql中创建了一个数据库,其中单个coloumn有多个值...
例如... coloumn名字'HOD',有各个部门的HOD'列表......
所有这些值必须填写在一个文本框中。
有谁知道如何这样做不使用javascript吗?
我尝试过:
Hello...
i have created one database in mysql where single coloumn having multiple values...
for example... coloumn having name 'HOD',has list of HOD'S FROM various department...
all this value has to be filled in a single textbox.
Does anyone know how to do this without using javascript?
What I have tried:
string sql = "select HOD,IS_HOD_APPROVED from ch_hod where REQ_RECORD_ID= '" + vals + "'";
command.CommandText = sql;
OracleDataReader reader = command.ExecuteReader();
reader.FetchSize = reader.RowSize * 1000;
while (reader.Read())
{
Session["Emp_hd"] = reader["HOD"].ToString();
}
lbl_name.Text = Session["Emp_hd"].ToString();
i在c#代码上方使用...
但这只会获取最后一个值.. ..
i used above code in c#...
but this will fetch only last value....
推荐答案
string sql = "select HOD,IS_HOD_APPROVED from ch_hod where REQ_RECORD_ID= @vals";
command.CommandText = sql;
command.Parameters.AddWithValue("@vals",vals);
OracleDataReader reader = command.ExecuteReader();
reader.FetchSize = reader.RowSize * 1000;
StringBuilder sb = new StringBuilder("");
while (reader.Read())
{
sb.Append(reader["HOD"].ToString());
sb.Append(Environment.NewLine);
}
Session["Emp_hd"] = sb.ToString();
lbl_name.Text = sb.ToString();
这篇关于如何从具有多个值的单列的数据库中填充texbox?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!