Exemplo n.º 1
0
        public void UpdateCEDB()
        {
            string strError = string.Empty;

            SQLDBCE.SetConnectString("Persist Security Info = False; Data Source = '..\\..\\Employee'; ");
            //SQLDBCE.SetConnectString("Persist Security Info = False; Data Source = ' D:\\DART\\Hackathon_Artifacts\\Hacathon_NOV\\SampleApp\\DataLoader\\Employee'; ");


            Statements stmt = new Statements();

            //Prepare DBscript for Low salary data insert
            stmt.CreateCEDBStmts();

            //Check for existance of records in the SQL CE DB
            DataTable dt = SQLDBCE.GetDataTable("SELECT * FROM Employee");

            //Delete existing records
            if (dt != null && dt.Rows.Count > 0)
            {
                strError = SQLDBCE.ExecuteQuery("DELETE FROM Employee");
            }

            if (string.IsNullOrEmpty(strError))
            {
                Console.WriteLine("Existing data deleted sucessfully from SQLCE DB.");
                Console.WriteLine();
            }
            else
            {
                Console.WriteLine("System Encountered Error.Press Enter to Terminate.");
                Console.ReadLine();
                System.Environment.Exit(0);
            }

            //Insert low salary records into SQL CE DB

            foreach (var item in stmt.lstCEDBScript)
            {
                strError = SQLDBCE.ExecuteQuery(item);
            }


            if (string.IsNullOrEmpty(strError))
            {
                Console.WriteLine("Data inserted sucessfully into SQLCE DB.");
                Console.WriteLine();
            }
            else
            {
                Console.WriteLine("System Encountered Error.Press Enter to Terminate.");
                Console.ReadLine();
                System.Environment.Exit(0);
            }
        }
Exemplo n.º 2
0
        public void GenerateExtDataFile()
        {
            string     strDBScripts = string.Empty;
            Statements stmt         = new Statements();

            stmt.CreateExSysDBStmts();
            strDBScripts = stmt.strExDBScript;
            Util.WriteToFile(strDBScripts);
            Console.WriteLine("Sucessfully written DDLs with data in the Flat file.");
            Console.WriteLine();
        }