|
-
Nov 16th, 2000, 05:04 PM
#1
Thread Starter
Addicted Member
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.
-
Nov 16th, 2000, 05:06 PM
#2
Hyperactive Member
Use the datagrid and adodc control.
set your sql statement
sql = "select * from mytable"
adodc1.datasource = sql
adodc1.refresh
-
Nov 16th, 2000, 05:12 PM
#3
Thread Starter
Addicted Member
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, 11:19 PM
#4
Hi, have u tried using rebind before refresh. I have a hunch that this might just work. Will keep in touch...vijay.
-
Nov 18th, 2000, 01:16 PM
#5
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|