none
Can't find Local Database in Visual C# 2013 express

    Question

  • Hi,

    I'm new to Visual C# and using a book that is based off visual c# 2010. It's asking me to add a local database to my project, but I'm only finding Service-based Database in c# 2013 express. Does local no longer exist? I had local database in c# 2012 express.

    Thanks in advance for answering my simple question.

    Thursday, January 16, 2014 10:17 PM

Answers

  • I wish that Microsoft did a better job of explain terminology of what is really occuring under the hood.  C# uses connection strings to interface to databases.  There is a wide variety of databases that are supported with the Net Library.  All uses connection strings.

    VS C# has to menu driven GUI that automatically creates the connection string under the hood which is what Muzz826 is using.  You have the option of not using the GUI Wizard and writing code to create the connection.  I prefer avoiding Wizards because it makes it easier to copy code from projects and makes it easier to debug the code.  The code generated by the wizards are burried in the project properties folder in XML files.

    A database is just a file.  All databases you provide and filename and driver in the connection string.  Some drivers are built into the Net library and others you use a driver not built int the Net Library.  Some databases you access by using filenames, others you can connect to through a Service, and some you can connect to either by filename or serverices.  There are many combinations of connection strings and the website www.connectionstrings.com is the first site to use to get a connection strings.  The wizard attempts to simplify the selection of connection strings.

    When you generate a local database it is installed inside the C# project folder and will automatically get deployed when a project is installed into another computer.  This may not be what you really want to do.  You may need the database that is not in project folder.  I don't know the answer to this question without more information.

    Please provide more info on your database requirements.  Is the database just going to be used for a single user application or a shared application.  Do you plan to use the database from just one PC or do you want to access the database from multiple PCs.


    jdweng

    Friday, January 17, 2014 1:41 AM

All replies

  • Things have changed since VS 2010.  In VS 2013 you'll be using SqlDB instead of SQL Express.  A service-based database is going to be an MDF which is basically what you would have created in SQL Express in the older versions.  However you don't even need to go that far if you're just playing around with some code.  Instead you can add a new database project which will be backed by SqlDB.  You can then design your database and set everything up using VS as you normally would.  Behind the scenes its generating the underlying SQL scripts to generate the database.  Whenever you debug and run it'll hook up to SqlDb.  This is how all the project templates are configured going forward so if you intend to play around with EF then you might as well set up your project now.  The downside is that you're going to get closer to SQL than you might be comfortable with. 

    If you're just starting out with databases as well then the service database approach is probably the closest you'll get to a tutorial written for VS 2010.  However you'll have to manually add the necessary config entry to your project to get it to work as SQL Express doesn't ship with VS anymore and the connection string any tutorial on VS 2010 will give you is going to use SQL Express.  Here's the steps for setting up an (equivalent) database in VS 2013.

    Michael Taylor
    http://msmvps.com/blogs/p3net

    Thursday, January 16, 2014 10:53 PM
    Moderator
  • I wish that Microsoft did a better job of explain terminology of what is really occuring under the hood.  C# uses connection strings to interface to databases.  There is a wide variety of databases that are supported with the Net Library.  All uses connection strings.

    VS C# has to menu driven GUI that automatically creates the connection string under the hood which is what Muzz826 is using.  You have the option of not using the GUI Wizard and writing code to create the connection.  I prefer avoiding Wizards because it makes it easier to copy code from projects and makes it easier to debug the code.  The code generated by the wizards are burried in the project properties folder in XML files.

    A database is just a file.  All databases you provide and filename and driver in the connection string.  Some drivers are built into the Net library and others you use a driver not built int the Net Library.  Some databases you access by using filenames, others you can connect to through a Service, and some you can connect to either by filename or serverices.  There are many combinations of connection strings and the website www.connectionstrings.com is the first site to use to get a connection strings.  The wizard attempts to simplify the selection of connection strings.

    When you generate a local database it is installed inside the C# project folder and will automatically get deployed when a project is installed into another computer.  This may not be what you really want to do.  You may need the database that is not in project folder.  I don't know the answer to this question without more information.

    Please provide more info on your database requirements.  Is the database just going to be used for a single user application or a shared application.  Do you plan to use the database from just one PC or do you want to access the database from multiple PCs.


    jdweng

    Friday, January 17, 2014 1:41 AM
  • i install vs 2013 and cant find lightswitch..

    do yo know what i must to do ?

    thank

    Sunday, April 13, 2014 3:30 PM
  • Do not hijack somebody else's thread for your question.  Please post your own question in the appropriate forums.
    Sunday, April 13, 2014 6:55 PM
    Moderator