3

I've started work on a project that requires an SQL Server Database. I will be building a front end application in c# .Net 3.5, that will use LINQ to SQL.

I need to host the database on a network share so that a group of users can all gain access to the database, mainly for read only.

I know that SQL Server Compact is designed to run on the local machine and my company is not willing to front the costs of a full blooded SQL Server.

Is there a way of achieving what I need to do via SQL Server Express?

If so, which are the best guides on how to set this up?

Thanks

Derek
  • 8,300
  • 12
  • 56
  • 88

2 Answers2

3

If you go with the (free) SQL Server express, it will do what you need - but you don't access it thru a network shared drive - the server would be located by an ip address (or equivalent DNS).

You c# application would be talking to a service - SQL Server - not reading to/from a database file. The service will handle the interaction with the database. Only the SQL Server service will need to know where the file actually is - your client machines won't know and shouldn't care.

If your background is only with file-based databases - i.e. MS Access, you need to change your mindset a bit about how SQL server works.

E.J. Brennan
  • 45,870
  • 7
  • 88
  • 116
  • Thanks for this, do you know of any good guides I could follow on this? – Derek Aug 14 '12 at 14:52
  • Here is one, but there are many tutorials to be found online: http://www.mssqltips.com/sqlservertip/2694/getting-started-with-sql-server-2012-express-localdb/ – E.J. Brennan Aug 14 '12 at 14:56
  • would i be better off using something like MS Access in this instance or even LINQ to XML? – Derek Aug 14 '12 at 19:07
1

You can install a SQL Server Express instance and install the SQL Management Studio Express for all users who need access to the database. The Express Edition is a standard SQL server with limitations regarding the number of processors used, the maximum amount of memory used and the maximum database size. If these limitations don't bother you, it should work fine for you.

Using a network share as a database storage to access db files from several clients is a bad idea, as the sql server instance should always be the only one directly accessing the database, both for read and write access. Configuring several instances of SQL Server to access the same database will probably not work - and if it works, it will probably create havoc in your database files.

Dirk Trilsbeek
  • 5,873
  • 2
  • 25
  • 23
  • I want to use the c# application to access the Database using the DataContext Class. Would this not be possible? The connection string would be pointing at the database on the network share? – Derek Aug 14 '12 at 14:14
  • Simple rule: database files may only accessed by _one single instance_ of whatever server uses them. May it be a SQL Server Compact or an Express Edition, more than one instance accessing the files at the same time calls for trouble. You can use an SQL Express instance, connect to the database using the SQL Server provider and use Linq to SQL to query the database. That would work on any number of clients. Using the database from an embedded SQL Server compact on more than one client would most surely not work - or, as i said, wreck havoc on your database files. – Dirk Trilsbeek Aug 14 '12 at 16:02