|
-
Jul 28th, 2000, 08:39 AM
#1
Thread Starter
Addicted Member
Howdy!
I can set up the Data connection through the data environment no problem, but is it possible to change the SQL statement through code for the Data Environment while the program is running?.
For example:
DE.dcn1.command1.commandtext = "Select * from Table1"
This doesn't work, If anyone has any ideas, it'll help.
Thanx
-
Jul 28th, 2000, 09:16 AM
#2
New Member
Try this:
Dim De as DataEnvironment1
De.Commands("Command1").CommandText = "your query here"
It works perfectly fine for me.
-
Jul 28th, 2000, 09:23 AM
#3
Thread Starter
Addicted Member
I keep getting
"Object variable or with not variable not set"
Error!
Am I missing something?
-
Jul 28th, 2000, 09:29 AM
#4
New Member
You should create an instance of your data environment first:
set De = new DataEnvironment1
and then establish the connections:
Dim i as integer
for i = 1 to De.Connections.Count
'Here u can also update properties like the data source, the user Id and the password:
'De.Connections(i).Properties("Data Source")= BckpServer
'De.Connections(i).Properties("Connect Timeout")=ConnectTimeout
'De.Connections(i).Properties("User ID")=UserName
'De.Connections(i).Properties("Password")=Password
'De.Connections(i).Open
next i
-
Jul 28th, 2000, 09:34 AM
#5
Thread Starter
Addicted Member
Now I'm getting
Class does not support Automation or does not support
expected interface
Set De = New DataEnvironment
It won't allow me to use this
Set De = New DataEnvironment1 - "User type not defined
Could I be missing a reference?
-
Jul 28th, 2000, 10:02 AM
#6
New Member
Use the name of your data environment class instead of
DataEnvironment1. In the french version of VB the default values are DataEnvironment1 and Connection1.
Change them to reflect the one you've created.
In your first message you had this line of code:
DE.dcn1.command1.commandtext = "Select * from Table1"
so juste change it by
DE.Commands.("command1").CommandText = "Select * from Table1"
If this doesn't work (after instanciation of your data environment of course) I can't do more. But be sure that it works fine!
-
Jul 28th, 2000, 10:04 AM
#7
Thread Starter
Addicted Member
I got it!
Thanx for your time!
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
|