I have a team working on a project. For the purpose of collaboration we are using Team Foundation Server.
Now we want to create a shared database so that each team member can connect to the database, manipulate it, and retrieve data.
I've already created a SQL Database Project and I've added it to TFS but I don't know how to connect to it from my code ?
The SQL Database Project is just a representation of the database schema and objects. It isn't a database that you "connect to".
Instead you will need a SQL server running somewhere. You might decide to run it locally on each of your dev machines or have a common server that everyone accesses. Either way, a regular SQL server needs to be installed somewhere.
This doesn't have anything to do with TFS. This is just a Visual Studio project like any other.
What exactly do you mean by "connect to it from my code"? .NET code doesn't directly interact with a database project, but can form a data access layer to interact with a database.
If you right-click on the database project in Visual Studio, there is an option to deploy (or perhaps publish, depending on the Visual Studio version). You can deploy the database project to a live database and then your .NET code can interact with that database.
This can be multiple databases. For example, your automated builds can deploy to a shared database for everyone to use, and individual developers can deploy to their local workstations for development and debugging purposes.
The Sql Database project is not a database in itself - it is a project that describes a database. You need to deploy that project (typically to an instance of Sql Server) in order to connect to it in the way you describe.
In a typical team development environment, each member of your team might have their own local instance of Sql Server, and deploy the project to it. In this way, your team members won't get in eachother's way as they create and delete data during the course of development. You will possibly also want a shared instance for a more formal testing environment.
So ultimately, what you've created is not a shared database: it's a template that a database can be created from.
Related
I want to create a setup file for an application that uses the following tools and technologies:
Microsoft visuals studio 2013
MSSQL server 2012
and I have used winforms and C# to write the program.
My questions are:
If I want to deliver the application to customer without giving out the source code what technique or tool should I use?
How do i supply the database? Should I detach it? How do I provide the database with my application?
I'm assuming you need to deploy the application you've created with Visual Studio rather than deploy Visual Studio itself. In which case you have a variety of options depending on its destination.
You can just copy your executable and required dependencies to a destination without distributing your source. However, there are several tools out there that will subsequently disassemble your assemblies to reveal the source.
The Visual Studio website has a list of options for deploying applications. If you want a tradional Next -> Next -> Finish type of installation, I would suggest using InstallShield Limited Edition.
For SQL deployment it would depend on the Edition you have used and whether the server already exists at the destination. Additionally, it will depend on whether you only need to deploy the schema or populate the database too.
You can distribute SQL Server Express with your application. SQL Server Management Studio will allow you to generate a "CREATE DATABASE" script (right-click database -> Script database as -> CREATE to -> File) from your existing database that can be executed as part of the installation. Alternatively, consider a backup/restore approach as detailed in this article.
I'm working on a website in visual studio for my senior project. I am trying to set up a login page for the website but since I have to be able to submit the finished project I was wondering if there was a way to set up the website administration tool to work anywhere.
i.e Is it possible to save/set up the sql server database that is used to login to the website on a flash drive where the entire project is stored? This way even if I open up the project on a different computer I will still be able to access all aspects of the project.
Any links to resources that I can scour would be greatly appreciated.
I am using Visual studio 2012 with asp.net 4.5
1.If you want a common database location which should be accessed by all, then you'd need to make certain that other machines have access to your local machine's database server
If you want the entire code plus the database to be present separately on each machine, then you'd need to share a database backup along with the application code folder and each machine would require the database backup to be restored on their database server along with setting up the application.
3.i can also prefer the Join me or VNC or any virtual tools to access your machine
I currently have an ASP.NET MVC 3 project, plus a class library project, that I am planning on open-sourcing. Before I do that though I want to clean up the project a little bit. One modification I want to make is with the database. Currently the site is published to a shared hosting server and I setup the SQL database on that server. However, since people will be forking the project and running it locally I'd like to just attach a SQL server express database or something that is part of the project. I want people to clone the repository, open the project, press F5 and have it run. Currently they'd have to setup a SQL database and create all the tables and stuff.
The solution consists of two projects: MvcUI and Domain. Domain is where all the application logic occurs. In fact, the domain is UI agnostic which means that it could be consumed by a desktop application just as easily as it could be by a web application.
I would like the database to be part of the Domain (class library) project. I have never done this before. If anyone could provide a simple explanation for how I would need to go about setting this up I would be thrilled. It would be very nice to have the database just be a in the solution because I could pre-populate it with some basic data. What do I need to do to get this database in my project as a database file or what not?
SQL Server Compact Edition is a portable SQL database that should do exactly what you are asking.
Microsoft SQL Server Compact 4.0 is a free, embedded database that
software developers can use for building ASP.NET websites and Windows
desktop applications. SQL Server Compact 4.0 has a small footprint and
supports private deployment of its binaries within the application
folder, easy application development in Visual Studio and WebMatrix,
and seamless migration of schema and data to SQL Server.
i have a winform application in c#on visual studio, connected to a database in sql server 2008 and i have done a deployment to it so to use it i must install the sql server management studio and restore the database backup, so Can i when doing the deployment and setup project include or take the database backup to not need to install the SQL server management studio on the PC use this application and from the application i will take a backup from the updated database which has new records
So how do i make a deployment and setup project and embedded in it the database used so i'll not be needed to install the sql server in the PC which act as a server and the clients PCs as i want to use the application in a network?
If your database is trivial, should be accessible from a single computer and is used to store local data look to the.
http://www.microsoft.com/sqlserver/2008/en/us/compact.aspx. For sure you will need to read additional articles about how to use it and deploy it, but this should be a starting point. NOTE: you will not have stored procedures and advanced SQL Server features, but you will use the same code as you do now.
Note that if you want to restored a database from backup to an arbitrary SQL Server instance, you may encounter problems if the instance to which the backup is being restored is configured with options different than the original SQL Server instance (e.g., collation sequence, case-sensitivity, ANSI settings, etc.) If the default collation sequence is different, you may have problems with indices, for instance.
You can use sqlcmd for that, it installs with MSSQL server on client machine look here for details.
After you created bat file, you can run it from code use Process.Start
It's not the SQL Management Studio that is needed to be installed to make the program work, it's SQLServer that must be installed.
For small applications it maybe to much of work to administrate a SQLServer, in that case its better to use other database types... I used to use XML files, lately I use Sqlite, its very good no installation required. and it integrates great into Visual Studio.
Edit: If you only need to restore a .bak you could use that http://sqlbackupandftp.com/restore/ its very nice and easy, and its a very small file.
I have one problem with service base database, I have used it in one of my application but I dont know if user who'll use it need to have something installed to be able to run application (like you need to have installed NET framework for c# applications)
Note: This is windows application
It depends on what database engine you're using. SQL Server/SQL Express/Oracle/MySQL require you install the application on the machine before it'll work. databases engines like SQLite and Firebird are just Dll's, so you can include then in your project.
If the file is an MDF that's a SQL Server file - you need to install SQL server, or SQL express.
You can include it with your app and do it silently:
http://social.msdn.microsoft.com/forums/en-US/sqlsetupandupgrade/thread/7180e4dc-5c1e-4501-83d7-6882abb1f04e/
You will need to install the relevant database engine with the correct service name, and create the database and relevant objects on installation.