|
-
February 4th, 2000, 07:07 AM
#1
Data Environment
How can I initialize the data environment by pressing a button, in order to connect to a different database each time?
Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece
-
February 4th, 2000, 07:11 AM
#2
Re: Data Environment
since the data environment can hold many different connections, you have to code that for each connection:
place this in a command button click handler:
de.Connection1.ConnectionString = "dsn=T0010;uid=sa;pwd=xxx;database=yourdb"
de.Connection1.Open
-
February 4th, 2000, 07:19 AM
#3
Re: Data Environment
I have a listview with all available databases in my disk. The user selects the desired and then presses the button. In the button click event I have placed your code but it fires, saying that the data environment is already open.
Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece
-
February 4th, 2000, 07:26 AM
#4
Re: Data Environment
then you have obviously already opened the connection to get the database information.
In that case you can do different things:
add a new connection to your data environment
or
close the old connection and reconnect it:
de.con.close
de.con.open newConnectionString
-
February 4th, 2000, 07:29 AM
#5
Re: Data Environment
I am trying to close the old connection, it works but it seems not to empty the previous data. I mean it seems to connect to the next database, but it displays the same old data.
Also, do I have to place some code to the data environment initialize event?
Michael Vlastos
Automation Engineer
Company SouthGate Hellas SA
Development Department
Athens, Greece
-
February 4th, 2000, 08:22 AM
#6
Re: Data Environment
>Also, do I have to place some code to the data environment initialize event?
I haven't done that.
It would probably help, if you posted more code.
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
|