0

I got a datgridview. I add 1 more column to get difference of Meter 2 and meter 1.

private void Loads()
        {
            ConnectionStringSettings conSettings = ConfigurationManager.ConnectionStrings["MyDBConnectionString"];
            string name = conSettings.ProviderName;
            string providerName = conSettings.ProviderName;
            string ConnectionString = conSettings.ConnectionString;

            string sql = "SELECT * FROM WaterRecord Order by RecordID DESC";

            SqlConnection connection = new SqlConnection(ConnectionString);
            connection.Open();
            sCommand = new SqlCommand(sql, connection);

            sAdapter = new SqlDataAdapter(sCommand);
            sBuilder = new SqlCommandBuilder(sAdapter);
            sDs = new DataSet();
            sAdapter.Fill(sDs, "WaterRecord");
            sTable = sDs.Tables["WaterRecord"];
            connection.Close();

            dataGridView1.DataSource = sDs.Tables["WaterRecord"];
            dataGridView1.ReadOnly = true;

            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            txtNote.Text = "";
        }
2
Contributors
1
Reply
2
Views
4 Years
Discussion Span
Last Post by nakor77
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.