private void ResetDatabase()
        {
            using (TestEFDeployEntities db = new TestEFDeployEntities(connstr))
            {
                db.Database.ExecuteSqlCommand("truncate table TestTable");
                db.SaveChanges();

                TestTable tt1 = new TestTable();
                tt1.DataValue = "this is record 1";
                db.TestTables.Add(tt1);
                db.SaveChanges();

                TestTable tt2 = new TestTable();
                tt2.DataValue = "this is record 2";
                db.TestTables.Add(tt2);
                db.SaveChanges();

                TestTable tt3 = new TestTable();
                tt3.DataValue = "this is record 3";
                db.TestTables.Add(tt3);
                db.SaveChanges();

                LoadListbox();
                lbIDs.SelectedIndex = 0;
            }
        }
        private void btnSave_Click(object sender, EventArgs e)
        {
            // save changes to the data field to the currently selected pkid record
            int param = GetSelectedPKID();

            if (param > 0)
            {
                using (TestEFDeployEntities ctx = new TestEFDeployEntities(this.connstr))
                {
                    TestTable savethis = (from rows in ctx.TestTables
                                          where rows.pkid == param
                                          select rows).FirstOrDefault();

                    savethis.DataValue = txtData.Text;

                    ctx.SaveChanges();
                }
            }
        }
        private void btnNew_Click(object sender, EventArgs e)
        {
            //create new testtable object
            //save it, letting the identity 1, 1 get set
            //reload listbox, go to appropriate index
            //focus one data textbox

            int       myid  = 0;
            TestTable newtt = new TestTable();

            //create the new record, get the pkid
            using (TestEFDeployEntities db = new TestEFDeployEntities(connstr))
            {
                db.TestTables.Add(newtt);
                db.SaveChanges();

                myid = newtt.pkid;
            }

            //reload the listbox
            LoadListbox();
        }