예제 #1
0
        ///<summary>
        ///获取数据库类型
        ///</summary>
        ///<param name="qdbtype"></param>
        ///<return>string</return>
        private string GetDbType()
        {
            DataBaseSection sec    = (DataBaseSection)ConfigurationManager.GetSection("Dcms.Orm/DataBase");
            string          dbtype = "";

            foreach (ConnectionItem item in sec.Items)
            {
                dbtype = item.dbtype;
                return(dbtype);
            }
            return("SqlServer2000");
        }
예제 #2
0
 ///<summary>
 ///获取数据库类型
 ///</summary>
 ///<param name="qdbtype"></param>
 ///<return>string</return>
 private void GetDbType()
 {
     try
     {
         DataBaseSection sec     = (DataBaseSection)ConfigurationManager.GetSection("Dcms.Orm/DataBase");
         string          connstr = "";
         foreach (ConnectionItem item in sec.Items)
         {
             dbtype = item.dbtype;
             if (dbtype.ToLower() != "dcsqlite")
             {
                 connstr = item.connectionstring;
                 string[] strar = connstr.Split(';');
                 for (int i = 0; i < strar.Length; i++)
                 {
                     if (i == 2)
                     {
                         continue;
                     }
                     if (i == 0)
                     {
                         conn = strar[i].Split('=')[1];
                         continue;
                     }
                     if (i == 1)
                     {
                         dbname = strar[i].Split('=')[1];
                         continue;
                     }
                     if (i == 3)
                     {
                         dbuser = strar[i].Split('=')[1];
                         continue;
                     }
                     if (i == 4)
                     {
                         dbpwd = strar[i].Split('=')[1];
                         continue;
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
     }
 }