?
Solved

Visual C#, Best way to access database over intranet with Windows Application

Posted on 2009-05-05
3
Medium Priority
?
1,236 Views
Last Modified: 2013-12-17
Hi Friends,

I am developing a Windows Application in VS 2008 with C#, this application will be installed on multiple computers in same office/Network and will access same database which will be saved on one computer at a pre-defined location. Now please suggest me.

1. How I can make my application to automatically discover the database, if not possible how i can serve the same database to my application installed on other computers in same network effiently.

2. Can I make a small Server sort of application which announces its presence on server and my application listen to that and connect for database access.

3. Right now we just map a network drive to shared database location and use it in our connection string. but for this we have manually change the connection string. Is it a recommended practice.

thanks in advance.
0
Comment
Question by:ArunVashist
3 Comments
 
LVL 27

Expert Comment

by:MikeToole
ID: 24312608
1) There's no built-in method in Access to announce the presence of a database - if you need that use SQL Server as your db engine (the Express edition is free!)
2) Again, this is the way that SQL Server handles it.
3) Set-up a share on your server and use UNC naming to in the connection string, e.g. \\MyServer\MyShare\MyAccessDB.mdb  - then at least you don't have to worry about drive mapping
0
 
LVL 39

Accepted Solution

by:
thenelson earned 750 total points
ID: 24314206
Splitting databases is a very common practice. Using common terminology will simplify the discussion. The part of the database that contains and serves the data is called the "backend". The part of the database that does most of the work and interfaces with the user (your C# program) is called the "frontend".

>2. Can I make a small Server sort of application which announces its presence on server and my application listen to that and connect for database access.<

How would the backend announce its presence? By writing a file somewhere? By creating a message? The front end will need to know where to look for the file or message. If there is a predetermined location for the file or message, why not just have a predetermined location for the backend. For speed and reliability, the location of the backend is important so you want to decide where to place it with careful deliberation anyway. I have a utility to use in An access frontend that that will search for and link to the backend at: http://www.thenelson.name/, Link To Backend. It in written to be placed into an Access front end so You would need to comet it but it may give you some ideas.

All databases are heavy network users. To reduce the risk of corruption and speed up the database, these are things to do for any database:

1: Make sure your hardware is in top shape, all computers are routinely vacuumed to remove dust and lint and your network is set up correctly. Have all the machines on the same domain.

2: Have individual front ends on each machine. I created a database that checks the server for a newer copy of the front end, downloads it if needed, then runs it. You can get a copy of it at: http://www.thenelson.name/, Updated Front End. This utility will work for a C# frontend with some modification.

3: Create a mapped drive for the backend or place the backend folder as close to the root folder and use only UNC path to the backend (the UNC path string should be as short as possible). Some people (and Microsoft) say the mapped drive is better, some say the UNC path is better. I have found it depends on the network setup.

4: Have the name of the backend and the name of the folders in the UNC path to it as short as possible meeting dos 8.3 naming specs and with only alpha numeric characters. \\server1\C:\db\db1_be.mdb is better than \\Database Server 601\C:\My Database Folder\Database Backends\My Database Backend_be.mdb

5: Don't run a local copy of the front end on the machine that has the backend -- best to have the backend on a true server running a domain with all workstations subscribed to the domain. You might get by running home version for two computers, maybe three sharing a very small, simple Access database on the home version although you may run into sharing problems. In a work situation, running a multi user Access database, all workstations should be running the pro version. It you have less than about five workstations, you might get away with the backend being on a system running pro but more than that or with a complicated database, you need a domain and the sever running a server OS. Get up to a dozen heavy users or a couple of dozen light users and the server should be a true server, be dedicated to only serving the one database and the backend should be SQL Server (or SQL Server Express)

All of this is cutting down the number of times accesses need to be qualified, files need to be opened and closed and reduces the complexity of parsing the path all of which reduces the chance of corruption and speed up the database.
0
 
LVL 52

Expert Comment

by:Gustav Brock
ID: 24334165
1. and 2.
Not easily and not recommended.

3. Recommended.
At all our clients we use mapped drives. If your environment lacks this option, just use the UNC path as already explained.

/gustav
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you need a simple but flexible process for maintaining an audit trail of who created, edited, or deleted data from a table, or multiple tables, and you can do all of your work from within a form, this simple Audit Log will work for you.
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
Suggested Courses

839 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question