elhacker.net cabecera Bienvenido(a), Visitante. Por favor Ingresar o Registrarse
¿Perdiste tu email de activación?.

 

 


Tema destacado: Los 10 CVE más críticos (peligrosos) de 2020


+  Foro de elhacker.net
|-+  Programación
| |-+  Programación General
| | |-+  .NET (C#, VB.NET, ASP) (Moderador: kub0x)
| | | |-+  Ejecución parcial de segunda consulta
0 Usuarios y 1 Visitante están viendo este tema.
Páginas: [1] Ir Abajo Respuesta Imprimir
Autor Tema: Ejecución parcial de segunda consulta  (Leído 1,615 veces)
dbadila

Desconectado Desconectado

Mensajes: 1


Ver Perfil
Ejecución parcial de segunda consulta
« en: 3 Septiembre 2020, 05:17 am »

He estado intentando crear una app que lee datos de una base de datos de access via C#, sin embargo al ejecutarse las consultas, y agregar los resultados al datagridview solo despliega 511 registros de 7684,  he realizado esto y se debe a que la segunda consulta solo se ejecuta hasta el registros 511 a que se debe esto?

Código:
string myConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +
                           "Data Source=OcupacionBA.mdb;";
 
            List<String> resultados = new List<String>();
 
            try
            {
                // Open OleDb Connection
                OleDbConnection myConnection = new OleDbConnection();
                myConnection.ConnectionString = myConnectionString;
                myConnection.Open();
 
 
                    // Execute Queries
                    OleDbCommand cmd = myConnection.CreateCommand();
                cmd.CommandText = "select Estacion,Frecuencia,Min(Intensidad),Max(Intensidad),Count(Frecuencia) from frecB GROUP BY Estacion, Frecuencia";
                    OleDbDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); // close conn after complete
 
 
 
 
                while (reader.Read())
                {
                    resultados.Add(reader.GetString(0) + "," + reader.GetDecimal(1) + "," + reader.GetDecimal(2) + "," + reader.GetDecimal(3) + "," + reader.GetInt32(4));
                }
 
 
                reader.Close();
 
 
 
            }
            catch (Exception ex)
            {
                Console.WriteLine("OLEDB Connection FAILED: " + ex.Message);
            }
 
 
 
            string[] R1 = resultados.ToArray();
 
            MessageBox.Show("" + R1.Length);
 
 
 
 
 
            try
            {
                // Open OleDb Connection
                OleDbConnection myConnection = new OleDbConnection();
                myConnection.ConnectionString = myConnectionString;
                myConnection.Open();
                int a = 0;
                for (int i = 0; i < R1.Length; ++i)
                {
 
                string[] datos = R1[i].Split(',');
 
                string estacion = datos[0];
 
                    double umbral = Convert.ToDouble(datos[2]) + 5;
 
                double frecuencia = Convert.ToDouble(datos[1]);
 
                // Execute Queries
                OleDbCommand cmd = myConnection.CreateCommand();
                cmd.CommandText = "select count(Id) from frecB WHERE Intensidad >=" + umbral + " AND Frecuencia =" + frecuencia + " AND Estacion = \"" + estacion + "\"";
                OleDbDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); // close conn after complete
 
                    int mm = 0;
 
 
                    while (reader.Read())
                    {
                    mm = reader.GetInt32(0);
 
 
                    DataGridViewRow fila = new DataGridViewRow();
                    fila.CreateCells(dataGridView1);
                    fila.Cells[0].Value = datos[0];
                    fila.Cells[1].Value = Convert.ToDouble(datos[1]);
                    fila.Cells[2].Value = Convert.ToDouble(datos[2]);
                    fila.Cells[3].Value = Convert.ToDouble(datos[3]);
                    fila.Cells[4].Value = umbral;
                    fila.Cells[5].Value = Math.Round(Convert.ToDouble(mm)/ Convert.ToDouble(datos[4])*100,4);
                    dataGridView1.Rows.Add(fila);
                        a = a + 1;
 
                    }
 
 
 
                }
 
 
 
 
 
 
 
 
            }
            catch (Exception ex)
            {
                Console.WriteLine("OLEDB Connection FAILED: " + ex.Message);
            }


En línea

Páginas: [1] Ir Arriba Respuesta Imprimir 

Ir a:  

Mensajes similares
Asunto Iniciado por Respuestas Vistas Último mensaje
Problema con codigo php ( consulta y ejecucion )
PHP
XXXXXX 9 3,325 Último mensaje 9 Agosto 2010, 01:30 am
por Shell Root
Consulta ejecucion
Software
salondono 0 1,248 Último mensaje 5 Abril 2011, 01:12 am
por salondono
MOVIDO: Parcial
Programación General
Eleкtro 0 1,432 Último mensaje 7 Noviembre 2015, 12:29 pm
por Eleкtro
(Consulta) Ejercicio de Listas en C - Error de Ejecucion
Programación C/C++
palacio29 0 1,597 Último mensaje 15 Octubre 2016, 18:12 pm
por palacio29
Problema con un Parcial de C
Programación C/C++
Azael 0 1,576 Último mensaje 3 Diciembre 2017, 03:30 am
por Azael
WAP2 - Aviso Legal - Powered by SMF 1.1.21 | SMF © 2006-2008, Simple Machines