Thread: C# Database

  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2007
    Rep Power

    C# Database

    I'm planning on making program with SQL database. If I work in visual studio and make .mdf file. And when program is finished, do users must have any server or something.

    can someone please explain me briefly about it. I'm not getting the full picture
  2. #2
  3. JavaScript is not spelt java
    Devshed Novice (500 - 999 posts)

    Join Date
    Feb 2011
    Landan, England
    Rep Power
    There are various options.

    If you're using SQL Server Express then you would most likely add the database directly to your project, selecting the 'Server-based Database' as the item template. That will add an MDF file to your project and that will be attached to the local SQL Server Express instance on demand. If appropriate, you can simply check the SQL Server Express item in the Prerequisites dialogue when publishing or in your Setup project. SQL Server Express will then be downloaded and installed if and only if required, just as the Framework is.

    If you're using SQL Server then the database won't actually be part of your project. You can leave the database as an independent step if you like, which would be most appropriate if its a multi-user database. Otherwise, you can include it in your Setup project as a Custom Action, either executing scripts to create and/or build the database, or maybe restoring a ready-made backup. You might require the user to input the server/instance name and/or database name during installation.

    Note that the SQL Server options can also apply to SQL Server Express if you don't want an MDF file in your project, e.g. for a multi-user database.
    [Quoted from an MS MVP]

    Alternatively, I believe you can include SQL Server Compact Edition entirely within your application. So, it depends.. :)

IMN logo majestic logo threadwatch logo seochat tools logo