Hello all, I am giving my code till now. Here my problem is i want to display One column value in textbox regarding to its id and every time a new data comes for this id i want the new data displays by textbox for this id. Please help.
protected void Page_Load(object sender, EventArgs e)
{
Label1.Text = DateTime.Now.ToString("MM-dd-yyyy h:mmtt");
using (SqlConnection Conn = new SqlConnection(ConnectionString);
{
DataTable dt = new DataTable();
Conn.Open();
SqlCommand sqlCmd = new SqlCommand("SELECT * from CurrentDataCR
", Conn);
SqlDataAdapter sqlDa = new SqlDataAdapter(sqlCmd);
sqlDa.Fill(dt);
if (dt.Rows.Count> 0)
{
TextBox1.Value = dt.Rows[0]["UpStreamLevel"].ToString();
TextBox2.Value = dt.Rows[1]["TotalDischarge"].ToString();
TextBox3.Value = dt.Rows[2]["TotalDischarge"].ToString();
TextBox4.Value = dt.Rows[3]["TotalDischarge"].ToString();
TextBox6.Value = dt.Rows[4]["TotalDischarge"].ToString();
TextBox7.Value = dt.Rows[5]["TotalDischarge"].ToString();
TextBox8.Value = dt.Rows[6]["TotalDischarge"].ToString();
TextBox9.Value = dt.Rows[7]["TotalDischarge"].ToString();
}
and my sql table is as follows...
cid date1 time1 id UpLevel DownLevel Discharge
1 06/12/2015 23:15 9001 488.97 482.18 1.39
2 06/12/2015 18:00 9001 450 0 1.4
3 06/12/2015 18:00 9002 550 0 2.2
4 06/12/2015 18:00 9003 487 0 1.5
5 06/12/2015 15:00 9002 486.3 0 1.4
6 06/12/2015 18:00 9005 523.2 0 1.6
7 06/12/2015 18:00 9006 499.2 0 2.2
8 06/12/2015 18:00 9007 502 0 2.3
9 06/12/2015 16:00 9003 478 0 1.7
10 06/12/2015 17:00 9009 0 0 0.53
12 06/12/2015 19:00 9008 478 0 1.7