Exemplo n.º 1
0
        public static bool Mapea_red()
        {
            NetworkShare.ConnectToShare(ConfigurationManager.AppSettings["pathDbf1"], "dmendoza", "Bata2013*");
            NetworkShare.ConnectToShare(ConfigurationManager.AppSettings["pathDbf2"], "dmendoza", "Bata2013*");
            //return true;


            return(true);
        }
Exemplo n.º 2
0
 public static bool Mapea_red()
 {
     NetworkShare.ConnectToShare(ConfigurationManager.AppSettings["pathDbf1"], "cquinto", "Spiderman100*");
     NetworkShare.ConnectToShare(ConfigurationManager.AppSettings["pathDbf2"], "cquinto", "Spiderman100*");
     return(true);
 }
Exemplo n.º 3
0
        public static DataTable Obt_dbf(string sql, int retail_noretail)
        {
            DataTable dt    = null;
            string    conex = "";

            try
            {
                if (retail_noretail == 1)
                {
                    conex = Conn2;
                    NetworkShare.ConnectToShare(ConfigurationManager.AppSettings["pathDbf2"], ConfigurationManager.AppSettings["pathDbf2_user"], ConfigurationManager.AppSettings["pathDbf2_pass"]);
                }
                else
                {
                    conex = Conn1;
                    NetworkShare.ConnectToShare(ConfigurationManager.AppSettings["pathDbf1"], ConfigurationManager.AppSettings["pathDbf1_user"], ConfigurationManager.AppSettings["pathDbf1_pass"]);
                }


                //File.WriteAllText(@"C:\WMS\LOG\LOGXXX.txt", conex);


                using (OleDbConnection dbConn = new OleDbConnection(conex))
                {
                    //FALTA EVALUAR new System.Data.OleDb.OleDbCommand("set enginebehavior 80", dbConn).ExecuteNonQuery();

                    dbConn.Open();

                    using (OleDbCommand cmd = dbConn.CreateCommand())
                    {
                        cmd.CommandText = "set enginebehavior 70";
                        cmd.ExecuteNonQuery();
                    }

                    // Obtenemos datos del DBF
                    System.Data.OleDb.OleDbCommand com = new System.Data.OleDb.OleDbCommand(sql, dbConn);
                    com.CommandTimeout = 0;
                    System.Data.OleDb.OleDbDataAdapter ada = new System.Data.OleDb.OleDbDataAdapter(com);
                    dt = new DataTable();
                    ada.Fill(dt);

                    if (dbConn != null)
                    {
                        if (dbConn.State == ConnectionState.Open)
                        {
                            dbConn.Close();
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                //if (dbConn != null)
                //    if (dbConn.State == ConnectionState.Open) dbConn.Close();

                // cquinto: message ? deberia grabar en el Log y continuar
                //ex.Message.ToString();
                throw ex;
                //dt = null;
            }

            //if (dbConn != null)
            //    if (dbConn.State == ConnectionState.Open) dbConn.Close();

            //OleDbConnection cnDBF = new OleDbConnection(conex);
            //cnDBF.Open();
            //OleDbCommand comando = new OleDbCommand(sql, cnDBF);
            //OleDbDataAdapter adaptador = new OleDbDataAdapter(comando);
            //DataTable tabla = new DataTable();
            //adaptador.Fill(tabla);

            // return datatable;
            return(dt);
        }