#3 MichaelXX
Kód:
public void Obnov_data() {
string constring = @"Data Source=xxxxxxxx";
string query = "select TOP 10 * FROM xxxxxxx ORDER BY create_datetime desc, scaling_id desc ";
SqlConnection con = new SqlConnection(constring);
SqlDataAdapter ada = new SqlDataAdapter(query, con);
DataTable dt = new DataTable();
ada.Fill(dt);
//float celkem = 0;
DataRow dr = dt.Rows[0];
created_9.Text = dr["create_datetime"].ToString();
netto_9.Text = dr["_weight"].ToString() + " kg";
brutto_9.Text = dr["brutto"].ToString() + " kg";
tara_9.Text = dr["tara"].ToString() + " kg";
carriage_9.Text = dr["carriage"].ToString();
scaleid_9.Text = dr["scaling_id"].ToString();
// celkem+= float.Parse(dr["_weight"].ToString());
dr = dt.Rows[1];
created_8.Text = dr["create_datetime"].ToString();
netto_8.Text = dr["_weight"].ToString() + " kg";
brutto_8.Text = dr["brutto"].ToString() + " kg";
tara_8.Text = dr["tara"].ToString() + " kg";
carriage_8.Text = dr["carriage"].ToString();
scaleid_8.Text = dr["scaling_id"].ToString();
// celkem += Int32.Parse(dr["_weight"].ToString());
dr = dt.Rows[2];
created_7.Text = dr["create_datetime"].ToString();
netto_7.Text = dr["_weight"].ToString() + " kg";
brutto_7.Text = dr["brutto"].ToString() + " kg";
tara_7.Text = dr["tara"].ToString() + " kg";
carriage_7.Text = dr["carriage"].ToString();
scaleid_7.Text = dr["scaling_id"].ToString();
// celkem += Int32.Parse(dr["_weight"].ToString());
dr = dt.Rows[3];
created_6.Text = dr["create_datetime"].ToString();
netto_6.Text = dr["_weight"].ToString() + " kg";
brutto_6.Text = dr["brutto"].ToString() + " kg";
tara_6.Text = dr["tara"].ToString() + " kg";
carriage_6.Text = dr["carriage"].ToString();
scaleid_6.Text = dr["scaling_id"].ToString();
// celkem += Int32.Parse(dr["_weight"].ToString());
dr = dt.Rows[4];
created_5.Text = dr["create_datetime"].ToString();
netto_5.Text = dr["_weight"].ToString() + " kg";
brutto_5.Text = dr["brutto"].ToString() + " kg";
tara_5.Text = dr["tara"].ToString() + " kg";
carriage_5.Text = dr["carriage"].ToString();
scaleid_5.Text = dr["scaling_id"].ToString();
// celkem += Int32.Parse(dr["_weight"].ToString());
dr = dt.Rows[5];
created_4.Text = dr["create_datetime"].ToString();
netto_4.Text = dr["_weight"].ToString() + " kg";
brutto_4.Text = dr["brutto"].ToString() + " kg";
tara_4.Text = dr["tara"].ToString() + " kg";
carriage_4.Text = dr["carriage"].ToString();
scaleid_4.Text = dr["scaling_id"].ToString();
// celkem += Int32.Parse(dr["_weight"].ToString());
dr = dt.Rows[6];
created_3.Text = dr["create_datetime"].ToString();
netto_3.Text = dr["_weight"].ToString() + " kg";
brutto_3.Text = dr["brutto"].ToString() + " kg";
tara_3.Text = dr["tara"].ToString() + " kg";
carriage_3.Text = dr["carriage"].ToString();
scaleid_3.Text = dr["scaling_id"].ToString();
// celkem += Int32.Parse(dr["_weight"].ToString());
dr = dt.Rows[7];
created_2.Text = dr["create_datetime"].ToString();
netto_2.Text = dr["_weight"].ToString() + " kg";
brutto_2.Text = dr["brutto"].ToString() + " kg";
tara_2.Text = dr["tara"].ToString() + " kg";
carriage_2.Text = dr["carriage"].ToString();
scaleid_2.Text = dr["scaling_id"].ToString();
// celkem += Int32.Parse(dr["_weight"].ToString());
dr = dt.Rows[8];
created_1.Text = dr["create_datetime"].ToString();
netto_1.Text = dr["_weight"].ToString() + " kg";
brutto_1.Text = dr["brutto"].ToString() + " kg";
tara_1.Text = dr["tara"].ToString() + " kg";
carriage_1.Text = dr["carriage"].ToString();
scaleid_1.Text = dr["scaling_id"].ToString();
// celkem += Int32.Parse(dr["_weight"].ToString());
dr = dt.Rows[9];
created_0.Text = dr["create_datetime"].ToString();
netto_0.Text = dr["_weight"].ToString() + " kg";
brutto_0.Text = dr["brutto"].ToString() + " kg";
tara_0.Text = dr["tara"].ToString() + " kg";
carriage_0.Text = dr["carriage"].ToString();
scaleid_0.Text = dr["scaling_id"].ToString();
// celkem += Int32.Parse(dr["_weight"].ToString());
// sum_netto.Text = celkem.ToString() + " kg";
}