コード例 #1
0
ファイル: GlobalVal.cs プロジェクト: Zhuhai-KB-ET/KB
        public static void InitConnection()
        {
            try
            {
                UserInfo.Connection = new SqlConnection[300];
                //下标1为厂别,下标2为数据库(1Live 2Samp 3Test 4Demo)
                DBConnectionString = new string[100, 20];

                try
                {
                    SQLiteSource.InitConnection(DBConnectionString);
                }
                catch
                {
                    MessageBox.Show("警告:SQLite数据库信息读取失败");
                    #region 1珠海凯邦
                    //正式数据库
                    DBConnectionString[1, 1] = "Data Source=DJ11-FWQS\\KBMSSQL;Initial Catalog=KB;User ID=kblive;Password=kbpassword#";
                    //测试数据库
                    DBConnectionString[1, 2] = "Data Source=DJ11-FWQS\\KBMSSQL;Initial Catalog=KBTEST;User ID=kbtest;Password=kbpassword#";

                    //预留报表平台数据库
                    DBConnectionString[1, 3] = "Data Source=erpdb01;Initial Catalog=test;User ID=reportAdmin;Password=reportAdmin#";
                    // DBConnectionString[1, 3] = "Data Source=pcbit-live01;Initial Catalog=test;User ID=reportAdmin;Password=reportAdmin#";
                    //预留报表平台数据库
                    DBConnectionString[1, 4] = @"Data Source=pcbdevelop02\sqlserver;Initial Catalog=F3_TEST;User ID=reportAdmin;Password=reportAdmin#";// "Data Source=erpdb01;Initial Catalog=demo;User ID=FOUNDER;Password=FOUNDER";
                    #endregion

                    #region 8郑州凯邦
                    DBConnectionString[8, 1] = "Data Source=dcerp03;Initial Catalog=dcv36Live;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[8, 2] = "Data Source=dcerp03;Initial Catalog=DCV36Samp;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[8, 3] = "Data Source=dcerp03;Initial Catalog=dcv36test;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[8, 4] = @"Data Source=pcbdevelop02\sqlserver;Initial Catalog=F1_TEST;User ID=reportAdmin;Password=reportAdmin#";// "Data Source=dcerp03;Initial Catalog=dcv36demo;User ID=reportAdmin;Password=reportAdmin#";
                    #endregion

                    #region 3重庆凯邦
                    DBConnectionString[3, 1] = "Data Source=erpdb02;Initial Catalog=live;User ID=developer;Password=system";
                    DBConnectionString[3, 2] = "Data Source=erpdb02;Initial Catalog=samp;User ID=developer;Password=system";
                    DBConnectionString[3, 3] = "Data Source=erpdb02;Initial Catalog=test;User ID=developer;Password=system";
                    DBConnectionString[3, 4] = @"Data Source=pcbdevelop02\sqlserver;Initial Catalog=F4_TEST;User ID=reportAdmin;Password=reportAdmin#";// "Data Source=erpdb02;Initial Catalog=demo;User ID=developer;Password=system";
                    #endregion

                    #region 4合肥凯邦
                    DBConnectionString[4, 1] = "Data Source=snerp02;Initial Catalog=live;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[4, 2] = "Data Source=snerp02;Initial Catalog=sample;User ID=dbtest;Password=liqiang@";
                    DBConnectionString[4, 3] = "Data Source=snerp01;Initial Catalog=test;User ID=dbtest;Password=lilinfeng";
                    DBConnectionString[4, 4] = @"Data Source=pcbdevelop02\sqlserver;Initial Catalog=F2_TEST;User ID=reportAdmin;Password=reportAdmin#";// "Data Source=snerp01;Initial Catalog=demo;User ID=dbtest;Password=lilinfeng";
                    #endregion
                }
            }
            catch (Exception e1)
            {
                log.PrintInfo(e1);
                System.Environment.Exit(0);
            }
        }
コード例 #2
0
        public static void InitConnection()
        {
            try
            {
                UserInfo.Connection = new SqlConnection[300];
                //下标1为厂别,下标2为数据库(1Live 2Samp 3Test 4Demo)
                DBConnectionString = new string[100, 20];

                try
                {
                    SQLiteSource.InitConnection(DBConnectionString);
                }
                catch
                {
                    MessageBox.Show("警告:SQLite数据库信息读取失败");
                    #region 1富山
                    DBConnectionString[1, 1] = "Data Source=erpdb01;Initial Catalog=live;User ID=FOUNDER;Password=FOUNDER";
                    DBConnectionString[1, 2] = "Data Source=erpdb01;Initial Catalog=samp;User ID=FOUNDER;Password=FOUNDER";
                    DBConnectionString[1, 3] = "Data Source=erpdb01;Initial Catalog=test;User ID=reportAdmin;Password=reportAdmin#";
                    // DBConnectionString[1, 3] = "Data Source=pcbit-live01;Initial Catalog=test;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[1, 4] = @"Data Source=pcbdevelop02\sqlserver;Initial Catalog=F3_TEST;User ID=reportAdmin;Password=reportAdmin#";// "Data Source=erpdb01;Initial Catalog=demo;User ID=FOUNDER;Password=FOUNDER";
                    #endregion

                    #region 8多层
                    DBConnectionString[8, 1] = "Data Source=dcerp03;Initial Catalog=dcv36Live;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[8, 2] = "Data Source=dcerp03;Initial Catalog=DCV36Samp;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[8, 3] = "Data Source=dcerp03;Initial Catalog=dcv36test;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[8, 4] = @"Data Source=pcbdevelop02\sqlserver;Initial Catalog=F1_TEST;User ID=reportAdmin;Password=reportAdmin#";// "Data Source=dcerp03;Initial Catalog=dcv36demo;User ID=reportAdmin;Password=reportAdmin#";
                    #endregion

                    #region 3越亚
                    DBConnectionString[3, 1] = "Data Source=erpdb02;Initial Catalog=live;User ID=developer;Password=system";
                    DBConnectionString[3, 2] = "Data Source=erpdb02;Initial Catalog=samp;User ID=developer;Password=system";
                    DBConnectionString[3, 3] = "Data Source=erpdb02;Initial Catalog=test;User ID=developer;Password=system";
                    DBConnectionString[3, 4] = @"Data Source=pcbdevelop02\sqlserver;Initial Catalog=F4_TEST;User ID=reportAdmin;Password=reportAdmin#";// "Data Source=erpdb02;Initial Catalog=demo;User ID=developer;Password=system";
                    #endregion

                    #region 4速能
                    DBConnectionString[4, 1] = "Data Source=snerp02;Initial Catalog=live;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[4, 2] = "Data Source=snerp02;Initial Catalog=sample;User ID=dbtest;Password=liqiang@";
                    DBConnectionString[4, 3] = "Data Source=snerp01;Initial Catalog=test;User ID=dbtest;Password=lilinfeng";
                    DBConnectionString[4, 4] = @"Data Source=pcbdevelop02\sqlserver;Initial Catalog=F2_TEST;User ID=reportAdmin;Password=reportAdmin#";// "Data Source=snerp01;Initial Catalog=demo;User ID=dbtest;Password=lilinfeng";
                    #endregion

                    #region 5重庆
                    DBConnectionString[5, 1] = "Data Source=cqerp04;Initial Catalog=live;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[5, 2] = "Data Source=cqerp04;Initial Catalog=sample;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[5, 3] = "Data Source=cqerp04;Initial Catalog=demo;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[5, 4] = @"Data Source=pcbdevelop02\sqlserver;Initial Catalog=F6_TEST;User ID=reportAdmin;Password=reportAdmin#";// "Data Source=cqerp04;Initial Catalog=demo;User ID=reportAdmin;Password=reportAdmin#";
                    //  DBConnectionString[5, 4] = @"Data Source=cqk201;Initial Catalog=INPLAN;User ID=cqinplantest;Password=cqinplantest#";
                    #endregion

                    #region 6高密
                    DBConnectionString[6, 1] = "Data Source=pcberp01;Initial Catalog=KBLIVE;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[6, 2] = "Data Source=pcberp01;Initial Catalog=KBDemo;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[6, 3] = "Data Source=pcberp01;Initial Catalog=KBTEST;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[6, 4] = @"Data Source=pcbdevelop02\sqlserver;Initial Catalog=F5_TEST;User ID=reportAdmin;Password=reportAdmin#";// "Data Source=pcberp01;Initial Catalog=KBTEST;User ID=reportAdmin;Password=reportAdmin#";
                    #endregion

                    #region 7外包厂
                    DBConnectionString[7, 1] = "Data Source=pcberp01;Initial Catalog=KBDEMO;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[7, 2] = "Data Source=pcberp01;Initial Catalog=KDO;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[7, 3] = "Data Source=pcberp01;Initial Catalog=KDO;User ID=reportAdmin;Password=reportAdmin#";
                    DBConnectionString[7, 4] = "Data Source=pcberp01;Initial Catalog=KDO;User ID=reportAdmin;Password=reportAdmin#";
                    #endregion
                }
                //#region 18测试环境
                //DBConnectionString[18, 1] = @"Data Source=[pcbdevelop02\sqlserver];Initial Catalog=F1-TEST;User ID=reportAdmin;Password=reportAdmin#";
                //DBConnectionString[18, 2] = @"Data Source=[pcbdevelop02\sqlserver];Initial Catalog=F2-TEST;User ID=reportAdmin;Password=reportAdmin#";
                //DBConnectionString[18, 3] = @"Data Source=[pcbdevelop02\sqlserver];Initial Catalog=F3-TEST;User ID=reportAdmin;Password=reportAdmin#";
                //DBConnectionString[18, 4] = @"Data Source=[pcbdevelop02\sqlserver];Initial Catalog=F4-TEST;User ID=reportAdmin;Password=reportAdmin#";
                //DBConnectionString[18, 5] = @"Data Source=[pcbdevelop02\sqlserver];Initial Catalog=F5-TEST;User ID=reportAdmin;Password=reportAdmin#";
                //DBConnectionString[18, 6] = @"Data Source=[pcbdevelop02\sqlserver];Initial Catalog=F6-TEST;User ID=reportAdmin;Password=reportAdmin#";
                //#endregion
            }
            catch (Exception e1)
            {
                log.PrintInfo(e1);
                System.Environment.Exit(0);
            }
        }