Ejemplo n.º 1
0
        public static SqlConnection GetDBConnection()
        {
            string dataSource = "DATABASE";

            dataSource += "\\";
            dataSource += "RDDATABASE";
            string database = "IPInfo";
            string username = "******";
            string password = "******";

            return(DBSQLServerUtils.GetDBConnection(dataSource, database, username, password));
        }
Ejemplo n.º 2
0
        public static void Main()
        {
            new Data();

            SqlConnection conn = DBSQLServerUtils.GetDBConnection();


            conn.Open();

            MongoDBUtils mongoutils = new MongoDBUtils("mongodb://localhost:27017");

            int numofrecords = getTotalRows(conn);
            int p            = numofrecords / 1000;
            int q            = numofrecords % 1000;

            //for (int i = 0; i < numofrecords; i += 1000)
            //{
            //    getIP(conn, i, i + 1000);

            //    while (Data.data.Count > 0)
            //    {
            //        mongoutils.insertData("fortest", "info", Data.data[0]);
            //        Data.data.RemoveAt(0);
            //    }
            //}

            getIP(conn, p * 1000, numofrecords);

            while (Data.data.Count > 0)
            {
                mongoutils.insertData("fortest", "info", Data.data[0]);
                Data.data.RemoveAt(0);
            }

            Console.WriteLine("cpmpleted");

            conn.Close();
        }