I have an application that is installed on 2 different work stations. When the application is activated I need to know if I'm working from test station1 or from test station2. How do I do this?
Keep in mind I'm using VB5.0...
I already thought about using the computer name.
I did the following: saved both computer names in the database (an access 97 database that I'm already using for other purposes) and then compared the computer names with the names in the database in the following way:
If glbStrName = rsTemp.Fields("station1_name" Then
flagTestStation = 1 'ts1
ElseIf glbStrName = rsTemp.Fields("station2_name" Then
flagTestStation = 1 'ts2
End If
(glbStrName is the computer name)
But I don't like this solution because I want to avoid saving the computer names in advance in the database.
I was wondering if there's a better way of doing this.
??
You have to know the computer name in order to find out which computer you work on... (or something else that is unique for that computer) You might as well hard code it into the program. I assume that it is for test purposes anyway.
Why do your need to know which pc your program runs on? Is the code dependant on which pc in runs on? Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
The code isn't dependant on the pc. The work station name is one of the things that's enetered into the DB, and also there are counters that have to be updated for each work station seperately...
The thing is that I don't want to hard code the work station name into the program cause if one day the workstation changes from computerA to computerB then there will be a problem. That's why I saved the station name in the DB, that way it's easy to change the work station name if necessary with out having to get into the VB code.
I was just wondering if there's any other way of doing this but if not then I guess my boss will have to live with it...
Make a table with columns for the PC name and for the counters in the database.
When the program opens (or closes?), look the pc name up in the database. If the name does not exist, add a new row with the pc name and appropiate values for the counters.
If the PC name is found in the table, use an UPDATE statement to edit the counter columns.
Sunaj
'The gap between theory and practice is not as wide in theory as it is in practice'
If it's just a counter on a particular PC then use the registry, with SaveSetting and GetSetting
________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first
'People who live in windowed environments shouldn't cast pointers.'
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.