DataEnvironment SQL change at run time

DataEnvironment SQL change at run time

Post by Mein » Sat, 24 Aug 2002 10:00:29



I am fairly new to VB and a real greenhorn on DataEnvironment,  but  I am
learning...

I am programmatically changing the CommandText property in a DataEnvironment
to a different SQL
statement but it does not reflect on a connected DataList control at run
time.
The DataList just stays with the queried data from the initial CommandText
as it shows in the
properties at design time. I have tried things like:

    Me.DataList2.ReFill
    Me.DataList2.Refresh
or
    deTZ.rscomNames.Requery

but nothing seems to work.
Maybe I am trying a completely wrong approach here.

Any ideas?
Meini

[--- This is a re-post to this newsgroup. The original message never seemed
to have appeared on ...vb.database ---]

 
 
 

DataEnvironment SQL change at run time

Post by Rames » Sat, 24 Aug 2002 22:41:22


I am not sure how you execute the command. Is it possible that you are not
doing an execute after you set the new commandText?

Here is how I am doing it.
' Change CommandText at runtime.
Private Sub Command1_Click()

 If DataEnvironment1.rsCommand1.State = adStateOpen Then

   DataEnvironment1.rsCommand1.Close

 End If

 With DataEnvironment1.Commands("Command1")

   .CommandType = adCmdText

   .CommandText = "SELECT * FROM Authors WHERE au_lname = 'Carson'"

   Set DataGrid1.DataSource = .Execute

 End With

End Sub

Also checkout this KB article
PRB: DataEnvironment Recordset Requery Does Not Refresh Controls
ID: Q191457

HTH!

Ramesh Thyagarajan, MCSD,MCDBA
Microsoft Developer support

This posting is provided "AS IS" with no warranties, and confers no rights.

Are you secure? For information about the Microsoft Strategic Technology
Protection Program and to order your FREE Security Tool Kit, please visit
http://www.microsoft.com/security.

 
 
 

1. DataEnvironment SQL change at run time

I am fairly new to VB and a real greenhorn on DataEnvironmet,  but  I am
learning...

I am programmatically changing the CommandText property to a different SQL
query but it does not reflect on the connected DataList control at run time.
It just stays with the data from the initial CommandText as it shows in the
properties at design time. I have tried things like:

    Me.DataList2.ReFill
    Me.DataList2.Refresh
or
    deTZ.rscomNames.Requery

but nothing seems to work.
Maybe I am trying a completely wrong approach here.

Any ideas?
Meini

2. SQL Server 7.0 Upgrade Interesting Problem .

3. Changing Active database in DataEnvironment at run time?

4. update 2.1v3 to ver. 5?

5. SQL in Delphi: how can i change the sql string during run time

6. Informix Data Director for VB

7. Add tables to DataEnvironments at run-time

8. xp_logininfo

9. Modify DataEnvironment Connection Strings at Run-Time

10. programming the database for a dataenvironment for run time

11. Changing Connection Properties At Run Time (T-SQL)

12. Changing SQL in a child command at run time