Results 1 to 5 of 5

Thread: GRIDS

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Location
    UK
    Posts
    199
    HELP HELP HELP HELP HELP HELP HELP HELP


    I am using the dataenvironment in VB6. I wish to change the recordset dynamically while the grid is displayed. I am failing to be able to do this. I have tried to use the datagrid control for adodc and have also tried to use the flexgrid but with little knowledge of this, gained no success.


    Thankyou all in advance.

    Bewildered
    Paul.

  2. #2
    Hyperactive Member barrk's Avatar
    Join Date
    Sep 2000
    Location
    My own little world
    Posts
    274
    Use the datagrid and adodc control.

    set your sql statement

    sql = "select * from mytable"

    adodc1.datasource = sql
    adodc1.refresh

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2000
    Location
    UK
    Posts
    199
    Hi Barrk

    I am trying to use the Data Environment. I close the recordset, change the sql statement, re-open the recodset, refresh the grid.........But nothing happens.

    I am trying to advoid using seperate ado controls, ie only using the data environment.

  4. #4
    Guest
    Hi, have u tried using rebind before refresh. I have a hunch that this might just work. Will keep in touch...vijay.

  5. #5
    New Member
    Join Date
    Oct 2000
    Posts
    2

    I am close but....

    Hi All,

    I am trying to do a similiar thing but I am getting an error when I add these 2 lines: (method or data member not found).

    Adodc1.DataSource = SQLstr
    Adodc1.Refresh

    Without the two above lines the code works and calculates the correct amount due, but the Grid never changes. It always contains the entire database.

    btw, I just started working with ADO.

    Here is my code:

    Private Sub optLocation_Click(Index As Integer)
    Const ConnectStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\My Documents\Soccer.mdb;"
    Dim SQLstr As String
    Dim myRS As New ADODB.Recordset
    Dim totalDue As Integer


    SQLstr="Select *....."

    myRS.ActiveConnection = ConnectStr
    myRS.Open SQLstr

    'Update Grid
    Adodc1.DataSource = SQLstr
    Adodc1.Refresh

    Do Until myRS.EOF
    totalDue = totalDue + myRS!PaymentDue
    myRS.MoveNext
    Loop
    lblTotal = totalDue
    myRS.Close
    Set myRS = Nothing
    End Sub


    Thanks Mike
    VB6.0 Professional

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