Ejemplo n.º 1
0
        private string GetListLineItem(LoadedDb poDbToOpen)
        {
            string xs = poDbToOpen.Description.Trim();

            if (xs.Length == 0)
            {
                xs = poDbToOpen.ConnStrOverride.TrimEnd();
            }

            if (xs.Length == 0)
            {
                xs = poDbToOpen.Database.TrimEnd();
            }
            xs = xs.Replace('\r', ' ');
            xs = xs.Replace('\n', ' ');

            return(xs);
        }
Ejemplo n.º 2
0
        private void LoadList()
        {
            string xsErrMsg = "";

            DB xoAppDB = new DB();

            if (Global.OpenThisAppsDatabase(ref xoAppDB))
            {
                //string xsSQL = "SELECT [ID], [database], [description], connStr, [source] FROM [database] ORDER BY [description]";
                string    xsSQL = "SELECT [ID], [database], [description], connStr, [source] FROM [database] ORDER BY IIF(ISNULL([description]) OR LEN(TRIM([description])) = 0, IIF(ISNULL([database]) OR LEN(TRIM([database])) = 0, [connStr], [database]), [description])";
                DataTable xoTbl = new DataTable();
                if (xoAppDB.SQL(xsSQL, xoTbl))
                {
                    mrLoadedDbs = new List <LoadedDb>(0);
                    if (xoTbl.Rows.Count > 0)
                    {
                        for (int xii = 0; xii < xoTbl.Rows.Count; xii++)
                        {
                            LoadedDb xoDB = new LoadedDb();
                            xoDB.ID              = Convert.ToInt16(xoTbl.Rows[xii][0]);
                            xoDB.Description     = null2str(xoTbl.Rows[xii][2]);
                            xoDB.Database        = null2str(xoTbl.Rows[xii][1]);
                            xoDB.ConnStrOverride = null2str(xoTbl.Rows[xii][3]);
                            xoDB.DataSource      = null2str(xoTbl.Rows[xii][4]);
                            mrLoadedDbs.Add(xoDB);
                        }
                    }
                }
                else
                {
                    xsErrMsg = xoAppDB.Message + "  (SQL: " + xsSQL + ")";
                }
                ReleaseTable(ref xoTbl);
            }

            if (xsErrMsg.Length > 0)
            {
                Global.ShowMessage(xsErrMsg, "Load Database List");
            }
        }