Почему DataBinding не работает над вторым разом вокруг?

Ошибка, которую я получил, когда я изменяю источник данных BindingSource

"привязка данных не может найти строку, которая подходит для всей строки привязки, которая подходит для всей привязки"

        this.RemoveAllBindings(); // My work-around for the meantime

        bdsOrder.DataSource = _ds.Tables["orders"]; // errors here on second time around(first time is blank datatable, second time is when i open existing record, then it errors), dataset comes from Remoting
        bdsOrderDetail.DataSource = _ds.Tables["order_detail"];

        bdsPhoto.DataSource = _ds.Tables["order_photo"];
        bdnPhoto.BindingSource = bdsPhoto;

Мое обходное решение метода расширения Помощника при трудности "привязки данных не может найти строку..." ошибкой.

namespace MycComponentExtension
{
    public static class Helper
    {
        public static void RemoveAllBindings(this Form form)
        {
            RemoveAllBindings((Control)form);
        }

        private static void RemoveAllBindings(this Control root)
        {
            foreach (Control c in root.Controls)
            {
                if (c.Controls.Count > 0) RemoveAllBindings(c);

                root.DataBindings.Clear();
            }
        }

То, каково значение "DataBinding, не может найти строку..." ошибкой, если вообще возможный, я могу устранить свое обходное решение на нем?

5
задан bendewey 25 March 2009 в 04:01
поделиться