Confusion Between Service Based Database,

Hi I am new to C # and I have been learning C # for the last 3 months and when starting my small project I created a service based database and used to store values ​​in tables. in my application i only deal with tables. and queries that will run on the same machine. I am creating a project that will only work on one machine. so now I realized that the difference between a service based database and a local database ** A service based database is a database that is only accessed through the server. It uses an MDF data file, which is a SQL Server format. To be able to connect to the SQL Server database, the SQL Server service must be started as it processes your queries and accesses the data file.

The local database is local to your application. It uses an SDF data file, which is a SQL Server CE (Compact Edition) format. No need to install a server to access the SDF database ** but I built the whole project with a service based database and used all the queries get fetched and updated. 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 going to the .sdf file for the local database do I just need to replace the new connection string? does it reflect any functioning?

+3


source to share


1 answer


If the database structures are the same, your code should (potentially) remain the same. The only thing that needs to be changed is the connection string.

There are other types of research that can differentiate between local and server storage, for example:

  • external process call
  • access to files
  • performance


etc.

But from a functional (general) point of view, your program only needs to change the connection string.

+2


source







All Articles