private void btnSave_Click(object sender, System.EventArgs e)
        {
            string sqlStatement;
            //根据是否正在添加新记录来建立适当的查询语句
            if (bNewRocord == true)
            {
                sqlStatement = "INSERT INTO Customers VALUES(" + "'" + cbxID.Text + "'," + "'" + txtCompanyName.Text + "'," + "'" + txtContactTitle.Text + "'," + "'" + txtAddress.Text + "'," + "'" + txtCity.Text + "'," + "'" + txtRegion.Text + "'," + "'" + txtPostalCode.Text + "'," + "'" + txtCountry.Text + "'," + "'" + txtPhone.Text + "'," + "'" + txtFax.Text + "')";
            }
            else 
            {
                sqlStatement = "UPDATA Customers SET " + "CompanyName= '" + txtCompanyName.Text + "'," + "ContactName= '" + txtContactName.Text + "'," + "ContactTitle= '" + txtContactTitle.Text + "'," + "Address= '" + txtAddress.Text + "'," + "City= '" + txtCity.Text + "'," + "Region= '" + txtRegion.Text + "'," + "PostalCode= '" + txtPostalCode.Text + "'," + "Country= '" + txtCountry.Text + "'," + "Phone= '" + txtPhone.Text + "'," + "Fax= '" + txtFax.Text + "," + "WHERE GetCustomeID= '" + cbxID.Text + "'"; 
            }            //创建sql命令
            SqlCommand sqlcmd = new SqlCommand(sqlStatement, sqlConnection1);
            try
            {
                sqlConnection1.Open();
                int rowAffected = sqlcmd.ExecuteNonQuery();
                if (rowAffected == 1)
                    cbxID.Items.Add(cbxID.Text);
            }
            catch (SqlException ex)
            {
                MessageBox.Show("更新错误:"+ex.Message,"出现错误",MessageBoxButtons.OK,MessageBoxIcon.Error);
            }
            finally
            {
                sqlConnection1.Close();
            }
            if (bNewRocord == true)
            {
                cbxID.DropDownStyle = ComboBoxStyle.DropDownList;
                bNewRocord = false;
                cbxID.SelectedIndex = cbxID.Items.Count - 1;
            }
        }