|
|
|
C# Select Multiple rows show in multiple Textbox [ERROR=ติดปัญหานิดหนอ่ยครับ] |
|
|
|
|
|
|
|
ลองดูแบบนี้ครับ
Code (C#)
txtW1.Text = (dt1.Row.Count >= 1) ? dt1.Rows[0]["Queue_ID"] + "";
txtW2.Text = (dt1.Row.Count >= 2) ? dt1.Rows[1]["Queue_ID"] + "";
txtW3.Text = (dt1.Row.Count >= 3) ? dt1.Rows[2]["Queue_ID"] + "";
txtW4.Text = (dt1.Row.Count >= 4) ? dt1.Rows[3]["Queue_ID"] + "";
txtW5.Text = (dt1.Row.Count >= 5) ? dt1.Rows[4]["Queue_ID"] + "";
txtW6.Text = (dt1.Row.Count >= 6) ? dt1.Rows[5]["Queue_ID"] + "";
txtW7.Text = (dt1.Row.Count >= 7) ? dt1.Rows[6]["Queue_ID"] + "";
txtW8.Text = (dt1.Row.Count >= 8) ? dt1.Rows[7]["Queue_ID"] + "";
|
|
|
|
|
Date :
2015-04-21 14:00:01 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (C#)
try
{
string sql1 = "select top 8 Queue_ID from tbl_Service where Status_Q NOT IN ('Treatment','Successfully') and convert(date ,Date_Q) = (CONVERT(date, GETDATE(), 120))";
DataTable dt1 = new DataTable();
SqlDataAdapter da1 = new SqlDataAdapter(sql1, connection);
da1.Fill(dt1);
TextBox[] tbs = { txtW1, txtW2, txtW3, txtW4, txtW5, txtW6, txtW7, txtW8 };
for (int i = 0; i < dt1.Rows.Count; i++)
{
tbs[i].Text = dt1.Rows[i]["Queue_ID"] + "";
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
|
|
|
|
|
Date :
2015-04-21 14:10:39 |
By :
ipstarone |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date :
2015-04-21 14:12:45 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TCAdmin + Progamon
ขอบคุณทุกคนที่เข้ามาตอบให้ครับ
|
ประวัติการแก้ไข 2015-04-21 14:21:32 2015-04-21 14:22:18
|
|
|
|
Date :
2015-04-21 14:16:55 |
By :
Zakariya |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|