protected void EditPhone(object sender, GridViewEditEventArgs e)
        {
            outputbox.Text += "Starting update sample..." + Environment.NewLine;
            
   
            // BEGIN Update Example
            DatabaseDotComContext context = (DatabaseDotComContext)Session["context"];
            DatabaseDotComClient client = new DatabaseDotComClient(context);

            outputbox.Text += "Starting update sample..." + Environment.NewLine;

            DatabaseDotComClient.DBCObject contact = new DatabaseDotComClient.DBCObject("Contact");

            HiddenField idField = (HiddenField)GridView1.Rows[e.NewEditIndex].FindControl("IdField");
            TextBox phoneText = (TextBox)GridView1.Rows[e.NewEditIndex].FindControl("newPhone");
            contact.Id = idField.Value;
            contact.SetStringField("Phone", phoneText.Text);
            outputbox.Text += "New Phone is:"+contact.GetStringField("Phone")+Environment.NewLine;
            DatabaseDotCom.DBDCReference.SaveResult sr;
            contact = client.Update(contact, out sr);
            outputbox.Text += "Update success result is: " + sr.success + Environment.NewLine + Environment.NewLine;
            System.Diagnostics.Debug.WriteLine("Row Updated");


            Query_Test();
        }
        protected void CreateMultiple_Click(object sender, EventArgs e)
        {
            DatabaseDotComContext context = (DatabaseDotComContext)Session["context"];
            DatabaseDotComClient client = new DatabaseDotComClient(context);
            outputbox.Text += "Starting Create with batch..." + Environment.NewLine;
            DatabaseDotComClient.DBCObject[] contacts = new DatabaseDotComClient.DBCObject[1];
            DatabaseDotComClient.DBCObject newContact1 = new DatabaseDotComClient.DBCObject("Contact");
            newContact1.SetStringField("FirstName", "Joe");
            newContact1.SetStringField("LastName", "Test1");

            DatabaseDotComClient.DBCObject newContact2 = new DatabaseDotComClient.DBCObject("Contact");
            newContact2.SetStringField("FirstName", "Joe");
            newContact2.SetStringField("LastName", "Test2");
            
            DatabaseDotCom.DBDCReference.SaveResult[] srs;
            contacts = client.Create(new DatabaseDotComClient.DBCObject[] { newContact1, newContact2 }, out srs);
            outputbox.Text += "Create was successful, new id is: " + contacts[0].Id + Environment.NewLine + Environment.NewLine;
            // END Create Example

            Query_Test();
        }
        protected void CreateSingle_Click(object sender, EventArgs e)
        {
            DatabaseDotComContext context = (DatabaseDotComContext)Session["context"];
            DatabaseDotComClient client = new DatabaseDotComClient(context);
            // BEGIN Create Example
            outputbox.Text += "Starting Create Sample..." + Environment.NewLine;
            DatabaseDotComClient.DBCObject newContact = new DatabaseDotComClient.DBCObject("Contact");
            newContact.SetStringField("FirstName", "Joe");
            newContact.SetStringField("LastName", "Test");
            DatabaseDotCom.DBDCReference.SaveResult sr;
            newContact = client.Create(newContact, out sr);
            outputbox.Text += "Create was successful, new id is: " + newContact.Id + Environment.NewLine + Environment.NewLine;


            Query_Test();
        }