Lightweight Maintenance Screens

The following can easily be turned into a lightweight maintenance screen:

        private void Form1_Load(object sender, EventArgs e)
        {
            _Conn = new SqlConnection(“My Connection String”);
            _Adapter = new SqlDataAdapter();
            _Adapter.SelectCommand = new SqlCommand(“execute wsp_my_select_all”, _Conn);
            _Builder = new SqlCommandBuilder(_Adapter);
            _DS = new DataSet();
            _Adapter.Fill(_DS);
            dataGridView1.DataSource = _DS.Tables[0];
            dataGridView1.Columns[0].Visible = false;
            dataGridView1.Columns[“rowversion”].Visible = false;   
        }

        private void SaveBtnClick(object sender, EventArgs e)
        {
            //Do something useful with any exceptions here
            _Adapter.Update(_DS, _DS.Tables[0].TableName);
        }

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s