How do i change SQL database NAME in visual studio 2012 - visual-studio

I changed the name to fish the old database comes back, when I look in App_data folder in file explorer I find the old database named food. So the website is using the old database. Also I've change the name in web.config.

Related

Database Schema Viewer functionality in vs2013

Recently migrated from vs 2010 -> vs 2013. Observed that there is no Database Schema Viewer in vs 2013 for DB projects. SQL Server Explorer does something similar but when you add new items (say a new table) to a project, noticed two things:
1. the new table file gets created in the root folder and not under the Schema Objects\Schemas\dbo\tables\
2. In vs2010, the table scripts used to have extension XX.table.sql but in vs2013, its always XX.sql
What actions can i take to achieve the above 2 behaviors as in vs 2010
Schema View is no longer part of Visual Studio. You'll have to use a 3rd party tool. If you have SQL Server Management Studio then you can use its database diagrams feature.
Visual Studio no longer manages the folder structure in database projects. When adding a new item, you should add it to the appropriate folder yourself.
To include the schema name in your files go to the database project's properties, select the Project Settings tab, and check Include schema name in file name. This change is not retroactive.

How to delete Sql Server Database

I created a database using Server Explorer Visual Studio of name MyDatabase.mdf (and MyDatabase.ldf). Now i want to delete it.I deleted it from Visual Studio using Server Explorer (means removed reference). Then i deleted MyDatabase.mdf and MyDatabase.ldf files from my C directory (C:\Program Files\Microsoft SQL Server\MSSQL10.SQLEXPRESS\MSSQL).
But when i try creating a new database with same name (MyDatabase), it gives an error and says, database name already exists, try some other name.
There are probably metabase attributes still left in your master table referencing your deleted tables. Instead of just deleting the MDF and LDF files, I would recommend using T-SQL DROP DATABASE statements. If you have MS SQL Management Studio, you could also right-click on your database and choose the "Delete" option.
Are you creating a User Instance of the database? If so, remove the "Initial Catalog" parameter from the connection string in the solution in Visual Studio if you have it defined.

Error opening the .mdf file to app_data

I am not able to add .mdf file in App_data(vs 2010 visual studio).
If I right click on App_data and try to add existing item and select mydatabase.mdf and click OK I am getting this error:
The file can not be opened because it is used by another process.Please close all applications that might access this file and try again.
But I am just running visual studio.
Not sure if you have found a solution for this, but I just ran into the same problem. I found some relevant info here:
How to add a new database under app_data with SQL Server Enterprise Edition
From this I gather that adding new AND existing databases (ie the .mdf file) via VS2010 is not possible.
I'm assuming (for this answer) that your end goal was the same as mine, i.e. to use the Microsoft Entity Framework to generate a model class from the database.
As I didn't want to install SQL express just to do this my solution was:
-Create any new db via SQL Server 2008 MGMT studio (or a script if you are that way inclined).
-Add a CONNECTION to the database in VS2010
-When adding a new model using the 'Entity Data Model Wizard' select 'Generate from database' and then select your existing connection, and the relevant table(s).
Worked for me!

Update model from database: Visual Studio uses the wrong database

I have a project with multiple EF databases; each EF model is in its own project, referenced from the other parts of the database.
Occasionally when I use the Update Model from Database... feature (right-clicking the graphical .EDMX view), Visual Studio gets into a state where it tries to update the .EDMX file for model A from the database associated with model B. For example, it shows "new tables" in the DB that it wants to import (which are actually in the other DB). Even exiting/restarting Visual Studio doesn't resolve the problem.
This question seemed to express the problem I'm seeing, but the accepted answer doesn't address my issue.
What is Visual Studio using to configure how it connects to the DB to find updates? Things I have checked:
My app.config connectionString in the DB project points to the right place. This is the file I would expect it to use.
I have tried setting the "Current Startup Project" to a an application that doesn't reference the "incorrect" DB project, thinking perhaps other projects' app/web.config connectionStrings might interfere; no visible effect.
Server Explorer shows a data connection to the "correct" DB, but not the "incorrect" one. This is probably a red herring; it showed as disconnected until I clicked on it, so I doubt it was being used anyway.
There is no string matching the name of the "incorrect" project/DB in the .csproj file. The .sln file contains only the expected project references. There is no .csproj.user file.
Any ideas? Is this a Visual Studio bug?
UPDATE: Other things tried:
Deleting the .suo file doesn't affect the problem.
I found some unexpected .datasource files that Visual Studio added under Properties at some point; moving these elsewhere hasn't had an effect, and Visual Studio hasn't attempted to recreate them. I looked inside, there's nothing referencing the other DB/project, just a GenericObjectDataSource element with items referencing the "correct" project. The presence of this file makes me suspicious but I'm currently stumped for how to probe further. I don't see equivalent files in any of the other projects in the solution.
/facepalm
Disregard. There were lingering tables in the "correct" database left over from the team's refactor of those tables out into the other database. The phantom tables were actually there in the DB.

VSS 2005 and VS 2005

I use VS 2005 and VSS 2005. Every time I close VS I get error: ss.ini not found. But except this VSS works fine, no problems when I open VS and do check in and check out. ss.ini is present and VSS repository specified as network path. I just worry that I can have problems later.
Ss.ini keeps track of your preferences, project locations, dialog settings, and such. The ss.ini needs to be in the user's folder for the data base. In my case, it is C:\DEV_\VSS\SourceSafe\users\amissico\ss.ini.
If the file exists, check permissions of folder and file. If the file doesn't exist, check permissions of folder.
Copy paste SS.ini file from user folder from another user folder into user folder with whom you are getting an issue like :
Source: Project\users\ajit\SS.ini
Destination: Project\users\Sujit\SS.ini
VSS provides Deploy command which allows you publish files to your web server. You can check the following link for more info:
http://msdn.microsoft.com/en-us/library/bb509340(v=vs.80).aspx

Resources