DataEnvironment SQL change at run time

DataEnvironment SQL change at run time

Post by Mein » Fri, 23 Aug 2002 21:21:30



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

 
 
 

DataEnvironment SQL change at run time

Post by Scot Ro » Sun, 25 Aug 2002 00:07:59


You have to first Close the rs.Command Object, then set the Command Text of the command object to teh new SQL, then reexecute the
command object which recreates the recordset. THen it would not hurt to rebind the list..

If DE.rsCommand.state=1 then de.rscommand.close
de.commands("Comamnd").CommandText="MyNewSQL"
de.Command

Set List.RowSource=DE

Scot Rose, MCSD
Microsoft Visual Basic Developer Support

Want to know more? Check out the MSDN at msdn.microsoft.com or the Microsoft Knowledge Base at support.microsoft.com

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

--------------------


>Subject: DataEnvironment SQL change at run time
>Date: Thu, 22 Aug 2002 22:21:30 +1000
>Lines: 20
>X-Priority: 3
>X-MSMail-Priority: Normal
>X-Newsreader: Microsoft Outlook Express 6.00.2600.0000
>X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000

>Newsgroups: microsoft.public.vb.database
>NNTP-Posting-Host: 202.47.52.151
>Path: cpmsftngxa10!tkmsftngp01!tkmsftngp12
>Xref: cpmsftngxa10 microsoft.public.vb.database:85387
>X-Tomcat-NG: microsoft.public.vb.database

>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


 
 
 

1. DataEnvironment SQL change at run time

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 ---]

2. Xfer files from Foxpro to Mainframe?

3. Changing Active database in DataEnvironment at run time?

4. PDOXWIN form question

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

6. Why won't this do the math?

7. Add tables to DataEnvironments at run-time

8. Needed experience with VB, ODBC (jet engine) and SQL server

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