Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all.

I want to start a project on windows application of .net framework.

But the problem is that some client wants that they access the database from server and other client wants they access database from its local.

So, will you please help me, how can i meet the requirement of client through one window application..


Thanks in advance.
Posted
Comments
Aravindba 20-Jan-14 3:37am    
Hai
How u find which user use server db and other user use local db ? u have any unique identification for that ? like higher and lower user or admin and ordinary user ?
BulletVictim 20-Jan-14 4:06am    
@Aravindba your idea seems good just one problem(I'm assuming the user rights you are asking about would be in the database) would you not already need to make the connection to the specific database in order to find that information or are you referring to windows authentications?

@Tilak Have you thought of maybe writing the database connection strings for each application into the registry of the computer that it is installed on? That way on each installation you would just need set the path to the database once and on each connection that you make in the application you refer back to the registry.
Just a thought

Also just to verify, the clients you refer to are in different "companies" or is it just different terminals that will be using the application?

Why I ask this is because if they are different "companies" will they always have access to the server database or will the database be hosted on their own servers?
If it is on their own servers then you will have to change your connection string for each deployment of a new "company" (then writing the connection to the registry might be the best practice(instead of publishing new versions for each client) for something like this you would want to keep your solution as generic as possible especially when it comes to updates for the application)

A personal note, It might not be the best practice to have the databases run on local machines(unless there is only one machine that will be using the application)
Rak_Avasthy. 20-Jan-14 5:07am    
Use application config file to store many connection strings and use a mechanism to choose specific connectionstring for specific user. That should do it i suppose
Trak4Net 20-Jan-14 14:37pm    
There are many questions that come to mind. In the most generic sense you provide a connection string from App.config or other runtime configurable place, never hard code connection string.

Is the database going to be accessed by multiple clients, do the clients need to know about changes made by other clients? If the database is local for some clients, does it need to synchronize with the server database such as an offline client?

1 solution

When code needs to access a database you have to provide a connection string. That connection string tells how to access the database including the name of the server. Therefore, it does not matter if it is local or on a server, all you have to do is provide a correct and valid connection string.

http://www.connectionstrings.com/[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900