Results 1 to 2 of 2

Thread: Unbound Datagrid problem

  1. #1

    Thread Starter
    New Member
    Join Date
    Aug 2000
    Posts
    12

    Exclamation

    Hello All

    I am doing the following. Please point me where I am going wrong.

    Code:
    public GRs as ADODB.Recordset
    
    private Sub Query_finish
    
    set GRs = new ADODB.Recordset
    GRs.Open "SELECT * FROM WSL", adOpenStatic, adLockPessimistic, adCmdText
    Debug.print GRs.Fields.Count
    DataForm.Show
    
    End Sub
    
    '---- Data Form  ---------
    ' Contains Adodc1 as ADODC
    ' Contains ManualEdit as DataGrid
    ' ManualEdit.DataSource = Adodc1
    
    private Sub Form_Load ()
    set Adodc1.Recordset = GRs
    End Sub
    When I execute the above code.. it produces empty DataGrid with 2 columns and 1 row. even though the Recordset contains lots of data ?

    I replaced the above DataGrid with MSHFlexGrid and it produced perfect result. Just that I cannot use it to edit data.

    Can someone point to me where I am going wrong .

    Thanks a lot

    Sathya
    Sathya Krishnamurthy
    Research Scientist , CSCS
    Switzerland

  2. #2
    Member
    Join Date
    Jun 2000
    Location
    Perth Western Australia
    Posts
    41

    Cool

    You are on the right track, but you don't need the ADODC1 control. The recordset you created is fine and you can now bind your DataGrid to that like this........


    Private Sub Form_Load ()
    SET ManualEdit.DataSource = GRs
    End Sub

    The ADODC control is just a method of connecting to a data base or file and creating a recordset to use. They are fine for some applications but your approach of creating the connection and recordset seperatly is more flexible and easier to maintain as code.

    I hope this has helped......


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width