Exemple #1
0
 protected void oracleTooracle_Click(object sender, EventArgs e)
 {
     try
     {
         if (sinosoft != null)
         {
             var TableList = ResultTableName();
             if (TableList != null && TableList.Count > 0)
             {
                 var OC    = new ValidFunc();
                 var VC    = new ValidClass();
                 var OHELP = new OracleHelper();
                 WriteOutput.IsExist(SaveAddress, "ORACLE");
                 for (int i = 0; i < TableList.Count; i++)
                 {
                     string Oraclecommtext = string.Format(@"select COLUMN_NAME ColumnName, DATA_TYPE ValueType,DATA_LENGTH TypeLength 
     from user_tab_columns where Table_Name='{0}' order by column_name", TableList[i]);
                     var    Alist          = OHELP.Read(Oraclecommtext, ORACLEDB);
                     var    Blist          = OHELP.Read(Oraclecommtext, ORACLEDB2);
                     OC.ValidOracleHelper(TableList[i], Alist, Blist, (T, A, B) => VC.VolidOracleToOracle(T, A, B, SaveAddress), (S, D) => VC.VolidAddOracle(S, D, SaveAddress));
                 }
                 if (DownLoadSQL("ORACLE"))
                 {
                     Response.Write("<script Language=JavaScript>alert('已在文本框中生成执行【oracle TO oracle 库表结构操作】sql!')</script>");
                 }
                 else
                 {
                     Response.Write("<script Language=JavaScript>alert('两个oracle数据库库表结构一致!')</script>");
                     this.sqli.Value = "";
                 }
             }
             else
             {
                 Response.Write("<script Language=JavaScript>alert('请选择要处理的表!')</script>");
             }
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemple #2
0
        static void Main(string[] args)
        {
            try
            {
                string SaveAddress = ConfigurationManager.AppSettings["SaveAddress"];
                Console.WriteLine("请输入要执行的操作编号:1、oracle  TO Sql Server 2012 ;2、oracle To oracle");
                var sinosoft = ConfigurationManager.GetSection("sinosoft") as SinosoftConfigure;
                if (sinosoft != null)
                {
                    var TableList = sinosoft.DBtable.ToList();
                    if (TableList != null && TableList.Count > 0)
                    {
                        var Select = Console.ReadLine();
                        var OC     = new ValidFunc();
                        var VC     = new ValidClass();

                        if (Select == "1")
                        {
                            WriteOutput.IsExist(SaveAddress, "MSSQL");
                            Console.WriteLine("oracle TO Sql Server 2012 库表结构操作");
                            var MS    = new MSSqlHelper();
                            var OHELP = new OracleHelper();
                            for (int i = 0; i < TableList.Count; i++)
                            {
                                string MSSqlcommtext  = string.Format(@"select syscolumns.name ColumnName, UPPER(systypes.name) ValueType, syscolumns.length TypeLength from syscolumns   
  left join systypes on syscolumns.xusertype =systypes.xusertype 
  where id=(select id from sysobjects where name='{0}') order by syscolumns.name", TableList[i].TableName);
                                string Oraclecommtext = string.Format(@"select COLUMN_NAME ColumnName, DATA_TYPE ValueType,DATA_LENGTH TypeLength 
from user_tab_columns where Table_Name='{0}' order by column_name", TableList[i].TableName);
                                var    Blist          = MS.Read(MSSqlcommtext);
                                var    Alist          = OHELP.Read(Oraclecommtext, true);
                                OC.ValidOracleHelper(TableList[i].TableName, Alist, Blist, (T, A, B) => VC.VolidOracleToMSSql(T, A, B), (S, D) => VC.VolidAddMSSql(S, D));
                                Console.WriteLine("已生成执行【oracle TO Sql Server 2012 库表结构操作】sql!  按任意键退出!");
                                Console.ReadKey();
                            }
                        }
                        else if (Select == "2")
                        {
                            Console.WriteLine("oracle TO oracle 库表结构操作");
                            var OHELP = new OracleHelper();
                            WriteOutput.IsExist(SaveAddress, "ORACLE");
                            for (int i = 0; i < TableList.Count; i++)
                            {
                                string Oraclecommtext = string.Format(@"select COLUMN_NAME ColumnName, DATA_TYPE ValueType,DATA_LENGTH TypeLength 
from user_tab_columns where Table_Name='{0}' order by column_name", TableList[i].TableName);
                                var    Alist          = OHELP.Read(Oraclecommtext, true);
                                var    Blist          = OHELP.Read(Oraclecommtext, false);
                                OC.ValidOracleHelper(TableList[i].TableName, Alist, Blist, (T, A, B) => VC.VolidOracleToOracle(T, A, B), (S, D) => VC.VolidAddOracle(S, D));
                                Console.WriteLine("已生成执行【oracle TO oracle 库表结构操作】sql!  按任意键退出!");
                                Console.ReadKey();
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }