Populate a flexigrid control with a recordset 
Author Message
 Populate a flexigrid control with a recordset

Hello

I would like to populate a flexigrid control with the results of a SQL
Server stored procedure which requires two parameters but don't know how to
do this. In addition, is the flexigrid control the best one to use for this
situation.

Any suggestions greatfully received.

Thanks

Chris



Sat, 14 Dec 2002 03:00:00 GMT  
 Populate a flexigrid control with a recordset

Quote:
> I would like to populate a flexigrid control with the results of a SQL
> Server stored procedure which requires two parameters but don't know how
to
> do this. In addition, is the flexigrid control the best one to use for
this
> situation.

Once you've established your recordset you can use a generic routine such as
this to fill the grid.

MH

'Call as:

Call FillGrid(Me, MSFlexGrid1, curRS)

Private Sub FillGrid(F As Form, G As MSFlexGrid, Rs As Recordset)

Dim R As Long, C As Integer

Rs.MoveLast
Rs.MoveFirst

With G
    .Redraw = False
    .Clear
    .Cols = Rs.Fields.Count
    .Rows = Rs.RecordCount + 1

   For C = 0 To .Cols - 1
        .TextMatrix(0, C) = Rs.Fields(C).Name
   Next C

  For R = 1 To .Rows - 1
      .Row = R
      For C = 0 To .Cols - 1
        .TextMatrix(R, C) = " " & Rs.Fields(C).Value
    Next
       Rs.MoveNext
  Next

 .Redraw = True
 .Visible = True

End With

Rs.Close

End Sub



Sat, 14 Dec 2002 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Can DBGrid be populated with the Recordset and not Data Control

2. Populating Listview control with recordset

3. Can DBGrid be populated with the Recordset and not Data Control

4. Populating Controls for Empty Value in Recordset

5. Is MS Hierarchial Flexigrid Control available in VB 6.0, Unicode Compliant

6. flexigrid control

7. Sorting a Flexigrid Control

8. Populate a recordset based on input from a form

9. Recordset not populating form (Experts only)

10. Populating Fields on a Form from Recordset

11. Populating Fields on Form from Recordset

12. Populating a recordset with filenames in a directory

 

 
Powered by phpBB® Forum Software