Beispiel #1
0
        //Funcion que busca los datos del Mayor General Detallado y Resumido
        public static DataTable MayorGeneral(string sqlstring)
        {
            try
            {
                DataTable dt = new DataTable();

                clsProcesos     con       = new clsProcesos();
                string          constring = con.conectar();
                MySqlConnection objCon    = new MySqlConnection();



                objCon.ConnectionString = constring;
                objCon.Open();
                //string consulta = sqlstring;
                //MySqlCommand comando = new MySqlCommand(consulta, objCon);

                //MySqlDataAdapter adap = new MySqlDataAdapter(comando);
                //adap.SelectCommand.CommandType = CommandType.StoredProcedure;

                //string cCadena = @"Server=localhost;Database=GsiSoft;Uid=root; Pwd=*010405;";

                MySqlDataAdapter oDataAdapter = new MySqlDataAdapter();
                oDataAdapter.SelectCommand             = new MySqlCommand();
                oDataAdapter.SelectCommand.CommandText = sqlstring;
                oDataAdapter.SelectCommand.Connection  = objCon;
                DataSet dsDatos = new DataSet();
                // oDataAdapter.Fill(dsDatos);
                //return dsDatos;

                oDataAdapter.Fill(dt);
                return(dt);
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                MessageBox.Show("Error : " + ex.Message, "Bancos", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                // ExceptionLog.LogError(ex, false);
                return(null);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message, "Bancos", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                clsExceptionLog.LogError(ex, false);
                return(null);
            }
            finally
            {
            }
        }
Beispiel #2
0
        //AUTOCOMPLE PARA CLIENTES

        //metodo para cargar los datos de la bd
        public static DataTable DatosClientes()
        {
            DataTable dt = new DataTable();

            clsProcesos     con       = new clsProcesos();
            string          constring = con.conectar();
            MySqlConnection objCon    = new MySqlConnection();

            objCon.ConnectionString = constring;
            objCon.Open();
            string       consulta = "SELECT * FROM empresas"; //consulta a la tabla paises
            MySqlCommand comando  = new MySqlCommand(consulta, objCon);

            MySqlDataAdapter adap = new MySqlDataAdapter(comando);

            adap.Fill(dt);
            return(dt);
        }
Beispiel #3
0
        //metodo para cargar los datos de la bd
        public static DataTable DatosGeneralEscalar(string tabla, string cExpresion)
        {
            try
            {
                DataTable   dt        = new DataTable();
                clsProcesos con       = new clsProcesos();
                string      constring = con.conectar();
                MySql.Data.MySqlClient.MySqlConnection objCon = new MySqlConnection();
                objCon.ConnectionString = constring;
                objCon.Open();

                string       consulta = "SELECT " + cExpresion + " As Retorno FROM " + tabla + " "; //consulta a la tabla paises
                MySqlCommand comando  = new MySqlCommand(consulta, objCon);

                MySqlDataAdapter adap = new MySqlDataAdapter(comando);

                //Turbi
                //dt.Locale = System.Globalization.CultureInfo.InvariantCulture;

                adap.Fill(dt);
                objCon.Close();
                return(dt);
            }
            catch (MySql.Data.MySqlClient.MySqlException ex)
            {
                MessageBox.Show("Error : " + ex.Message, "Bancos", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                clsExceptionLog.LogError(ex, false);
                return(null);
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error : " + ex.Message, "Bancos", MessageBoxButtons.OK,
                                MessageBoxIcon.Information);
                clsExceptionLog.LogError(ex, false);
                return(null);
            }
            finally
            {
            }
        }