コード例 #1
0
        public void CheckAdapterA(string[] newtablenames)
        {
            ClearAdapterManager();
            if (newtablenames == null || newtablenames.Length == 0)
            {
                tableNames = new string[1] {
                    null
                };
                adapters = new object[1] {
                    null
                };
                return;
            }

            List <string> newnames = new List <string>();
            int           i, k = newtablenames.Length;

            if (k > 20)
            {
                k = 20;
            }
            for (i = 0; i < newtablenames.Length; i++)
            {
                var s = newtablenames[i];
                if (string.IsNullOrEmpty(s))
                {
                    continue;
                }
                if (newnames.Contains(s))
                {
                    continue;
                }
                newnames.Add(s);
            }
            newnames.Add(null);

            tableNames = newnames.ToArray();
            adapters   = new object[newnames.Count];

            if (tableAdapterManager == null)
            {
                return;
            }

            DataSetHelper dh = KlonsDataModule.St.GetDataSetHelper(MyDataSet);

            if (dh == null)
            {
                return;
            }

            for (i = 0; i < tableNames.Length; i++)
            {
                var s = tableNames[i];
                if (s == null)
                {
                    continue;
                }
                if (!this.DesignMode)
                {
                    var ad = dh.GetDataAdapter(s);
                    adapters[i] = ad;
                    SetAdapterInManager(GetAdapterClassName(s), ad);
                    if (ad == null)
                    {
                        MessageBox.Show("Table adapter not found for: " + s, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }