| From: | "Ariel" <buenasalud(at)ubbi(dot)com> | 
|---|---|
| To: | 'Hazel Muñoz' <hamucacr(at)gmail(dot)com>, "'Andres Gutierrez'" <adivisi(at)gmail(dot)com> | 
| Cc: | <pgsql-es-ayuda(at)postgresql(dot)org> | 
| Subject: | RE: datagrid de VB 6.0 | 
| Date: | 2006-04-18 19:49:21 | 
| Message-ID: | 005701c66321$304a15b0$fa5367c0@GISARIEL | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-es-ayuda | 
Hazel
Mira la solucion que encontre pero que no es nada prolija, pero me ayudo
para salir de un apuro, consiste en crear otra consulta en donde devuelvo
con un count la cantidad de registros que tiene la consulta, y ase valor lo
uso como equivalente de lo que me tendría que devolver el RecordCount. Por
que VB siempre devuelve el valor de -1
Ariel
_____
De: pgsql-es-ayuda-owner(at)postgresql(dot)org
[mailto:pgsql-es-ayuda-owner(at)postgresql(dot)org] En nombre de Hazel Muñoz
Enviado el: Martes, 18 de Abril de 2006 13:42
Para: Andres Gutierrez
CC: pgsql-es-ayuda(at)postgresql(dot)org
Asunto: Re: [pgsql-es-ayuda] datagrid de VB 6.0
Estoy utilizando un código que encontré en internet, en lugar de usar un
datagrid normal utiliza un MSHFlexGrid, como no he podido hacerlo funcionar
no sé cuál es la diferencia entre ambos.
Aquí va el Sub Load() del Form que tiene el datagrid, no funciona el
RecordCount porque siempre me devuelve -1.  ¿Cómo puedo llenar un datagrid,
aunque sea uno de los normales? 
Private Sub Form_Load()
SQL = "Select * from responsable"
Set cnUsuario = New ADODB.Connection
cnUsuario.ConnectionString = "DRIVER=PostGreSQL;
Server=localhost;Port=5432;User
Id=postgres;Password=tulipazules;Database=SORA;" 
cnUsuario.Open
Option1.Value = True
Set rsResponsable = New ADODB.Recordset
rsResponsable.Open SQL, cnUsuario, adOpenDynamic, adLockOptimistic 
Dim i, j
    'tell the grid how many columns to have 
    MSHFlexGrid1.Cols = rsResponsable.Fields.Count
    'tell the grid how many rows to have + 1 
    MSHFlexGrid1.Rows = rsResponsable.RecordCount + 1
    j = 0
    With rsResponsable
        'this loop only fills up the grid captions along the top with the
field "name" not the value 
        MsgBox rsResponsable.RecordCount, "Error"
                
        Do While j < .Fields.Count + 1
           If Not IsNull(.Fields(j).Name) Then
           MSHFlexGrid1.TextMatrix(i, j) = .Fields(j).Name
           MSHFlexGrid1.TextMatrix(0, 0) = .Fields(j).Name
           End If
           j = j + 1
        Loop
    End With
    'With rsResponsable
        'move to the first record 
        .MoveFirst
        i = 1
       Do While i <= .RecordCount
            j = 0
            'this loop now fills up the grid with the field "value"
           Do While j < .Fields.Count 
               If Not IsNull(.Fields(j).Value) Then
                   MSHFlexGrid1.TextMatrix(i, j) = .Fields(j).Value
              End If
               j = j + 1
           Loop
           .MoveNext 'move to the next record 
           i = i + 1
        Loop
   End With
End Sub
-- 
Hazel MC 
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Marcelo Retamal | 2006-04-18 19:49:23 | Formato Fecha | 
| Previous Message | Juan Martínez | 2006-04-18 19:41:38 | Re: datagrid de VB 6.0 |