confusion between service based database and local database

10,076

If the databases structures are the same, your code (potentially) has to be remain the same. The only thing has to be changed is the connection string.

There are other type of issures that can make difference between local and server side storage like:

  • external process invokation
  • file access
  • performance

and so on..

But from functional (generic) point of view , your program should change only connection string.

Share:
10,076

Related videos on Youtube

shariq_khan
Author by

shariq_khan

Updated on September 15, 2022

Comments

  • shariq_khan
    shariq_khan over 1 year

    hi i am new to c# and i am a student learning c# from last 3 month and when starting my small project i created a service based database and use to store the values in the tables. in my app i am only dealing with the tables. and queries which will be working on a single machine. i am generating a project which only will be working on a single machine. so i now realised diffrence between service based database and local database **A service-based database is a database that is only accessed through a server. It uses an MDF data file, which is SQL Server format. To be able to connect to a SQL Server database the SQL Server service must be running, because it's that that processes your requests and access the data file.

    A local database is one that is local to your application only. It uses an SDF data file, which is SQL Server CE (Compact Edition) format. There is no need to install a server to access an SDF database** but i formed the whole project with the service based database and used all queries which is select and update. and i used this code

    connectionString = @"Data Source=.\
        SQLEXPRESS;AttachDbFilename=E:\project\Database1.mdf;Integrated 
        Security=True;User Instance=True";
    sqlConnection = new SqlConnection(connectionString);
    

    but when shifting to .sdf file means to local database i just have to replace the new connection string? does it reflects to any of the functioning?

  • shariq_khan
    shariq_khan about 11 years
    thank you sir and which will be better considering the performance? and what is external process invokation? and what is file access? i dont understand the file access as database doesnt store any files? right?
  • Tigran
    Tigran about 11 years
    @shariq_khan: I just listed some examples of possible difference, I have no idea how your application works. Someone may need to onvoke som external process on user request, or save a file ..or something else. If you use only database, the difference between local and server would in be in performance (imo), as usually the server is a most powewrful machine in company. But performance is a context related stuff, so it has to be measured, as, I repeat, I have no idea of requirements and architecture of your app.
  • shariq_khan
    shariq_khan about 11 years
    sir it is just a simple data entry app which will be working on single machine which does not have any server so i can use local machine as i heard of taking backup only needs to copy the .sdf file and replacing with the old one so i am shifting the server database to server database
  • Tigran
    Tigran about 11 years
    whel, if it's simple data entry, and you don't want data sharing between difference PC's, the local DB is, may be, most suitable solution. If you may need to share data between difference PC, you can think of having some central DB, but in this case, you have to have a correct netwrok setup, users and all administrating stuff setuped correctly, or implement some Import/Export feature in your application.