Exemple #1
0
        private DataBaseInfo GetDbInfo(int DbLinkId)
        {
            IDbLink    dal    = new DbLink();
            DbLinkInfo dlinfo = dal.DbLinkGetInfo(DbLinkId);

            IDataBase      dbDal         = new CurrencyDal.CodeMaker.DataBase();
            string         rstmsg        = "";
            string         tableName     = "";
            List <string>  tableNameList = new List <string>();
            DbDataTypeEnum dtype         = DbDataType.GetDbDataType(dinfo.NameType);

            if (dtype == DbDataTypeEnum.表)
            {
                tableName = dinfo.Name;

                //oracle数据库表名大写
                if (dlinfo.DbType == 2)
                {
                    tableName = tableName.ToUpper();
                }

                tableNameList.Add(tableName);
            }
            DataBaseInfo dbinfo = dbDal.DataBaseGetInfo(dlinfo, tableNameList, out rstmsg);

            return(dbinfo);
        }
        private DataBaseInfo GetDbInfo(int ID)
        {
            IDbLink    dal    = new DbLink();
            DbLinkInfo dlinfo = dal.DbLinkGetInfo(ID);

            IDataBase      dbDal         = new  CurrencyDal.CodeMaker.DataBase();
            string         rstmsg        = "";
            List <string>  tableNameList = new List <string>();
            string         tableName     = "";
            DbDataTypeEnum dtype         = DbDataType.GetDbDataType(dinfo.NameType);

            if (dtype == DbDataTypeEnum.表)
            {
                tableName = dinfo.Name;
                tableNameList.Add(tableName);
            }
            DataBaseInfo dbinfo = dbDal.DataBaseGetInfo(dlinfo, tableNameList, out rstmsg);

            //DataBaseInfo2 info = new DataBaseInfo2();

            //try
            //{
            //switch (dlinfo.DbType)
            //{

            //    case 1:
            //        System.Data.Common.DbConnection connSql = new System.Data.SqlClient.SqlConnection();
            //        connSql.ConnectionString = "Data Source=" + dlinfo.DataSource + ";Initial Catalog=" + dlinfo.DbName + ";User ID=" + dlinfo.UserName + ";Password="******"Data Source=" + dlinfo.DbName + ";User ID=" + dlinfo.UserName + ";Password="******"";
            //        info.GetOracleDb(connOracle);
            //        break;
            //    case 3:
            //        string ConnString = dlinfo.DataSource;
            //        info.LoadFromAccess2000(ConnString);
            //        break;

            //}
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show("操作失败。" + ex.Message);
            //}

            return(dbinfo);
        }
        private DataBaseInfo GetDbInfo()
        {
            IDbLink    dal    = new DbLink();
            DbLinkInfo dlinfo = dal.DbLinkGetInfo(dinfo.DbLinkID);

            IDataBase     dbDal         = new CurrencyDal.CodeMaker.DataBase();
            string        rstmsg        = "";
            List <string> tableNameList = new List <string>();

            tableNameList.Add(dinfo.Name);
            DataBaseInfo dbinfo = dbDal.DataBaseGetInfo(dlinfo, tableNameList, out rstmsg);

            return(dbinfo);
        }
        private DataBaseInfo GetDbInfo()
        {
            IDbLink dal     = new DbLink();
            int     id      = 0;
            var     lisitem = comboBoxDB.SelectedItem as ListItem;

            id = string.IsNullOrEmpty(lisitem.ID) ? 0 : int.Parse(lisitem.ID);
            //id = comboBoxDB.SelectedValue.ToString() == "" ? 0 : int.Parse(comboBoxDB.SelectedValue.ToString());
            var dlinfo = dal.DbLinkGetInfo(id);

            IDataBase     dbDal         = new CurrencyDal.CodeMaker.DataBase();
            string        rstmsg        = "";
            List <string> tableNameList = new List <string>();
            string        tableName     = lb_DbMessage.Text;

            if (tableName.IndexOf(",") > 0)
            {
                string[] nameitem = tableName.Split(',').ToArray();
                if (listTable.Count > 0)
                {
                    listTable.Clear();
                }
                foreach (var item in nameitem)
                {
                    listTable.Add(item);
                    tableNameList.Add(item);
                }
            }
            else
            {
                if (listTable.Count > 0)
                {
                    listTable.Clear();
                }
                listTable.Add(tableName);
                tableNameList.Add(tableName);
            }


            DataBaseInfo dbinfo = dbDal.DataBaseGetInfo(dlinfo, tableNameList, out rstmsg);

            return(dbinfo);
        }