Obtener Matriz desde un DataSet...
Publicado por Hades (1 intervención) el 05/09/2006 18:31:13
Hola, me gustaria que alguien me ayudara con este problema, estoy llenando una matriz de cadenas (string) con el contenido de una tabla (Table) que se encuentra en un DataSet. Esto funciona, pero lo estoy haciendo con un ciclo FOR campo por campo, lo cual me esta tomando muchísimo tiempo. Si me pueden ayudar con esto se los agradeceré. Incluyo un resumen del código fuente donde estoy teniendo el problema:
Dim DataAdapter As New OleDbDataAdapter(comando)
Dim ld_num_regs As Integer, li_i As Integer, li_j As Integer, li_cols As Integer
Dim ld_aux As New DataSet
.
.
.
Dim regs(ld_num_regs - 1, li_cols - 1) As String
For li_i = 0 To ld_num_regs - 1
For li_j = 0 To li_cols - 1
regs(li_i, li_j) = ld_aux.Tables(0).Rows(li_i)(li_j).ToString()
Next li_j
If li_i = 65532 Then
Exit For
End If
Next li_i
oSheet.Range("A4").Resize(ld_num_regs, li_cols).Value = regs
.
.
.
Dim DataAdapter As New OleDbDataAdapter(comando)
Dim ld_num_regs As Integer, li_i As Integer, li_j As Integer, li_cols As Integer
Dim ld_aux As New DataSet
.
.
.
Dim regs(ld_num_regs - 1, li_cols - 1) As String
For li_i = 0 To ld_num_regs - 1
For li_j = 0 To li_cols - 1
regs(li_i, li_j) = ld_aux.Tables(0).Rows(li_i)(li_j).ToString()
Next li_j
If li_i = 65532 Then
Exit For
End If
Next li_i
oSheet.Range("A4").Resize(ld_num_regs, li_cols).Value = regs
.
.
.
Valora esta pregunta


0