If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Delphi, C etc > Help needed on DataEnvironment Design

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-14-03, 12:18
heidil90 heidil90 is offline
Registered User
 
Join Date: Mar 2003
Posts: 9
Unhappy Help needed on DataEnvironment Design

I have a question about Data Environment that I used in a VB utility. Usually when I make a connection object, I set connection string through the property dialog interface in the design time. Now I want to set the connection string dynamically in the run time, for example, the utility can be run both in my local and server, how to do that?


Thanks in advance!
Reply With Quote
  #2 (permalink)  
Old 05-14-03, 13:03
dbadelphes dbadelphes is offline
Registered User
 
Join Date: Feb 2003
Location: Montreal, Canada
Posts: 117
Re: Help needed on DataEnvironment Design

Public Sub DataEnvironment_Initialize()
If Connection1.State = adStateOpen Then Connection1.Close
Connection1.Properties("Data Source").Value = your_server_name
Connection1.Properties("Initial Catalog").Value = your_database_name
Connection1.Properties("User ID").Value = user_name
Connection1.Properties("Password").Value = password
Connection1.Open
End Sub

where Connection1 is your connection.

Quote:
Originally posted by heidil90
I have a question about Data Environment that I used in a VB utility. Usually when I make a connection object, I set connection string through the property dialog interface in the design time. Now I want to set the connection string dynamically in the run time, for example, the utility can be run both in my local and server, how to do that?


Thanks in advance!
__________________
Steve
Reply With Quote
  #3 (permalink)  
Old 05-14-03, 13:25
heidil90 heidil90 is offline
Registered User
 
Join Date: Mar 2003
Posts: 9
Re: Help needed on DataEnvironment Design

Thank you, Steve!

When I debug the code, it runs fine in the initilization of data environment, however, it stuck in the frmMain form_load.

I made command object named Course. I retrieved the titles into a datacombo box from Course Table in the database by using recordeset.

ctlCourse.text=deWS.rsCourse!Title


The system complains that Invalid object name 'Module'.

Before I tried to set different connection, it runs fine in this line.

Do you have any idea about this problem? Thanks a lot!

Heidi
Reply With Quote
  #4 (permalink)  
Old 05-14-03, 13:33
heidil90 heidil90 is offline
Registered User
 
Join Date: Mar 2003
Posts: 9
Re: Help needed on DataEnvironment Design

))) Thanks a ton, Steve!

I figured out why it complains about invalid object name. Now it runs fine!


Have a nice, nice spring day!

Heidi
Reply With Quote
  #5 (permalink)  
Old 05-14-03, 13:50
dbadelphes dbadelphes is offline
Registered User
 
Join Date: Feb 2003
Location: Montreal, Canada
Posts: 117
Re: Help needed on DataEnvironment Design

Do you have some functions defined in a module?
Does your recordset is supposed to be open before entering into DataEnvironment_Initialize Sub. In this case the recordset will lose the connection, meaning that you'll need to re-open it. I suggest to open your recorset once the connection established (Initialize Sub), and use DataSource and DataMember properties of the combo to link the data.

Could you post your code here?


Quote:
Originally posted by heidil90
Thank you, Steve!

When I debug the code, it runs fine in the initilization of data environment, however, it stuck in the frmMain form_load.

I made command object named Course. I retrieved the titles into a datacombo box from Course Table in the database by using recordeset.

ctlCourse.text=deWS.rsCourse!Title


The system complains that Invalid object name 'Module'.

Before I tried to set different connection, it runs fine in this line.

Do you have any idea about this problem? Thanks a lot!

Heidi
__________________
Steve
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On