Author |
Topic |
Utpal
Posting Yak Master
179 Posts |
Posted - 2003-05-16 : 01:54:36
|
Hi everybody,I have developed an Inventory application in VB 6.0 - SQL Server 7.0. When the application is run the first time, it will prompt the user to enter the server name, to which the application will connect. I want the application to save the server name somewhere, so that when the application is run the next time, it retrieves the saved server name and connects to that server. I thought of saving to a text file and retrieving from it. But a text file could be easily deleted or modified. Is there a better way?Edited by - Utpal on 05/16/2003 02:00:28Edited by - merkin on 05/16/2003 02:29:37 |
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-05-16 : 02:30:39
|
This is more a VB question than a SQL Server question. I think using the registry would be the ideal place to store application settings. You could encrypt the connection string if you were paranoid.Damian |
 |
|
Utpal
Posting Yak Master
179 Posts |
Posted - 2003-05-16 : 02:36:07
|
Thanks Damian! If the server name is stored in the registry of the server computer, would the client computers be able to retrieve it? |
 |
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-05-16 : 02:46:13
|
No.When the user runs the client for the first time, they type in the server name (which is what you said). Then it is stored in the CLIENTS registry. The next time the user runs the application, the server name is retrieved from the registry.Storing client settins in the server registry doesn't make any sense.Damian |
 |
|
Andraax
Aged Yak Warrior
790 Posts |
Posted - 2003-05-16 : 03:19:18
|
Hi Utpal. If you want to use the client registry, look into the SaveSetting and GetSetting functions in VB. |
 |
|
Utpal
Posting Yak Master
179 Posts |
Posted - 2003-05-16 : 03:41:56
|
Thanks to both! quote: When the user runs the client for the first time, they type in the server name (which is what you said). Then it is stored in the CLIENTS registry. The next time the user runs the application, the server name is retrieved from the registry. Storing client settins in the server registry doesn't make any sense.
I meant that when the application is run the first time, the server name should be saved somewhere (most likely on the server), so that when the application is run the next time by any client, the same server name is retrieved and used. |
 |
|
Andraax
Aged Yak Warrior
790 Posts |
Posted - 2003-05-16 : 04:02:37
|
That's not so good a plan Utpal. That way, you still have to have some hard-coded reference to the server somewhere on the client, where the client picks up the servername from the server.I agree with Merkin, the best way is to ask the user for the server name the first time, then save it in the client registry. If you save the servername on the server, then what will happen if you switch to another server with another name for some reason?Edited by - andraax on 05/16/2003 04:03:11 |
 |
|
Utpal
Posting Yak Master
179 Posts |
Posted - 2003-05-16 : 05:07:06
|
Thanks Andraax! quote: That way, you still have to have some hard-coded reference to the server somewhere on the client, where the client picks up the servername from the server.
The application will be installed only on the Windows NT Server and each client will run the application using a shortcut to the exe file in the application folder on the server. The server name could be stored in some way in the application folder and the application path could be used to pick up the server name. So the application folder path would act as the hard-coded reference to the server name location on the client. quote: If you save the servername on the server, then what will happen if you switch to another server with another name for some reason?
In such a case, the server name setting on the server would have to be changed only on the server. Whereas if the setting is stored in the client's registry, it would have to be changed on all the clients. |
 |
|
Andraax
Aged Yak Warrior
790 Posts |
Posted - 2003-05-16 : 06:22:35
|
Hi Utpal. Since you run the application from the server, I agree with you. Sorry I misunderstood. |
 |
|
Utpal
Posting Yak Master
179 Posts |
Posted - 2003-05-16 : 08:09:32
|
quote: Hi Utpal. Since you run the application from the server, I agree with you. Sorry I misunderstood.
So finally according to you is there a better way than using a text file as I had described? |
 |
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-05-16 : 10:18:19
|
It doesn't make any sense. You want to client to do a lookup on the server to find out where the server is ?????Damian |
 |
|
Utpal
Posting Yak Master
179 Posts |
Posted - 2003-05-17 : 01:33:29
|
quote: It doesn't make any sense. You want to client to do a lookup on the server to find out where the server is ?????
The client won't have to do a lookup on the server computer for the SQL server name, because the text file containing the SQL server name will be located in the application's folder, whose path can be retrieved in VB using App.path. |
 |
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-05-17 : 10:22:26
|
Which is what we were talking about before, except I suggested using the registry.Then you said :quote: the server name should be saved somewhere (most likely on the server)
Make up your mind.Damian |
 |
|
Utpal
Posting Yak Master
179 Posts |
Posted - 2003-05-19 : 01:25:43
|
quote: The application will be installed only on the Windows NT Server and each client will run the application using a shortcut to the exe file in the application folder on the server.
I also said this, which most probably you must have overlooked, because you still seem to be under the impression that the application will be installed on the client computer, which is not. The application will be installed only on the Windows NT Server, in whose folder the server name could be stored. The client can specify the application path on the Windows NT server using app.path. |
 |
|
Merkin
Funky Drop Bear Fearing SQL Dude!
4970 Posts |
Posted - 2003-05-19 : 03:20:25
|
If the application will only run on the server machine, why do you need to store the server name at all ?Damian |
 |
|
Utpal
Posting Yak Master
179 Posts |
Posted - 2003-05-19 : 04:28:01
|
quote: If the application will only run on the server machine, why do you need to store the server name at all ?
The application will also be run from client machines using shortcuts(on the client machines) pointing to the exe file of the application on the server machine.Edited by - Utpal on 05/19/2003 04:29:32 |
 |
|
|