Visual CSharp .NET - Consultas mdb - c#

 
Vista:
sin imagen de perfil
Val: 5
Ha disminuido 1 puesto en Visual CSharp .NET (en relación al último mes)
Gráfica de Visual CSharp .NET

Consultas mdb - c#

Publicado por Diego (3 intervenciones) el 03/09/2020 03:42:22
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, a que se puede deber hay alguna limitante en el datagrid?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
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);
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

Consultas mdb - c#

Publicado por Nacho (23 intervenciones) el 03/09/2020 12:00:38
Tiene límite pero mucho más alto que 8.000 o 500. Mostrará las que hay o le has dicho que muestre.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

Consultas mdb - c#

Publicado por Nacho (23 intervenciones) el 05/09/2020 13:43:46
Los programas hacen siempre lo que les dices que hagan. No se inventan cosas, ni se equivocan, ni te tienen manía.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
-1
Comentar

Consultas mdb - c#

Publicado por Diego (3 intervenciones) el 05/09/2020 18:40:53
Aporte 0.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar