PDA

Click to See Complete Forum and Search --> : GRIDS


PaulTilley
Nov 16th, 2000, 04:04 PM
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.

barrk
Nov 16th, 2000, 04:06 PM
Use the datagrid and adodc control.

set your sql statement

sql = "select * from mytable"

adodc1.datasource = sql
adodc1.refresh

PaulTilley
Nov 16th, 2000, 04:12 PM
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.

Nov 16th, 2000, 10:19 PM
Hi, have u tried using rebind before refresh. I have a hunch that this might just work. Will keep in touch...vijay.

cobrahoo
Nov 18th, 2000, 12:16 PM
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