I have created a few clr stored procedures and had them setup to our development environment. I now want to update the connection string on the database tab of the project but its not saving. Here is the list of things I have done:
I checked to make sure that the project file and user project file were not read-only
I have deleted the user project unloaded the project and reloaded and the project and created a new connection string
I am not sure what else to do, has anyone else had issues updating database connection string in a Sql Service Project?
Visual Studio 2008 doesn't update the connection strings properly when you edit them, it adds a new string instead of replacing them. Look in your app.config file and you might have multiple instances of the string that are named the same.
Related
I have created two projects with same connection manager names. Though the names are same, they point to two different environments.
I was assuming that if I add package from one project to other I should not face the connection manager related issues.
But I still get the error that connection manager "" not found.
Does this mean that even if I have same connection manager name, I still need to open each DFT and change the connection managers manually?
Regards,
K
I think understand what is being asked here.
Project 1
Project level connection we'll call "TestConnection"
SSIS Package we'll call "TestPackage1" is using project level connection "TestConnection"
Project 2
Again, Project level connection we'll call "TestConnection"
SSIS Package we'll call "TestPackage2" is using project level connection "TestConnection"
You move "TestPackage1" from Project 1 to Project 2 and now all data flow, execute sql task are complaining of missing connection manager.
You asked:
Does this mean that even if I have same connection manager name, I
still need to open each DFT and change the connection managers
manually?
Short answer.... Yes
Understand that behind the scenes with SSIS packages each object, data flow, execute sql task, sources, destinations, connection managers are assign a unique GUID. That unique GUID is used by each object when referencing each other within the project/solution they were created in.
So even if you move the package from one project to another and the connection manager was named the same, that connection manager would not have the same GUID from project to project.
You can see that when look at the code for the connection manager and looking at the code of the package.
From within Visual Studio:
with the package open click on View -> Code from the tool bar
Then right click on the connection manager in Solution Explorer and click on View Code
This will get you a view of the XML code. If I scroll down in my package code to one of the data flows you'll see the connectionManageID is referencing the GUID of the connection manager:
You could, and I have in the past when dealing with large packages, identity the GUID from the project you've copied the package to and GUID the package is referencing then do a find and replace in the code. Save, close all and reopen. I do caution against this
as you could easily, completely break the package if not done correctly. This would be completely at your own risk and I'd make sure you have backup copies of everything prior to even attempting it.
If your package isn't that big, just manually go update each of the tasks.
I work with MVC code first and I us local DB (DB in app_data file) and I'm single programmer.
In visual studio, I create "develop branch" and change the database in develop.
then I checkout to master.
BUT Database changed for master and master need to "add migration" and "update database"
that's the problem that goes along with every checkout.
as Microsoft says, each branch, need to separate DB.
Can I have separate db for each branch?
notice: I work with local db and I dont have microsoft sql server management
This happens because you have different code bases on both branches. This of course is why you have separated branches on the first place.
Code first controls your database comparing your migrations with __MigrationHistory table, which is automatically created when use are using code first approach.
Even using localDb you could create separate DBs for each branch. You can use Sql Server Object Explorer from within Visual Studio. Create your two databases there, instead of under app_data.
Then for every branch you can have a different connection string in your config file. Same connection string key, but pointing to a different DB.
After the Crash of my Laptop I was able to recover the data that I had on the hard drive. In the meantime I have a new Laptop and I'm restoring my last ASP.NET MVC Core Project in Visual Studio 2015 (Community).
In this Project I've created a database using EF Core Code First.
In SQL Server Object Explorer (on my old Laptop) the database was showing up.
Visual Studio saved the data under the path "C:\Users\USERNAME".
In appsetting.json the Connection string was "DATABASEDbConnection": "Server=(localdb)\\mssqllocaldb;Database=DATABASE_v1;Trusted_Connection=True;MultipleActiveResultSets=true".
My new Laptop has the exact Name of the old one.
I've copied the database in the same Location as before.
But:
the database does not Show up in SQL Server Object Explorer, and I have no idea how to bind it again
if I try to run my Project I get this error:
SqlException: Cannot open database "DATABASE_v1" requested by the login. The login failed Login failed for user 'USER-PC\USER.
How can I bind again my database?
After googling a couple of hours, I've found the solution.
I started Microsoft SQL Server Management Studio and added a reference to (localdb)\MSSQLLOcalDB and from there it was possible to bind my database located in C:\Users\USERNAME.
The localdb instance in VS seems to be influenced by SQL Server Management Studio. The latter rules binding to user's DBs.
I'm wondering why localdb does not start authomatically when running SQL Server Management Studio.
I'm not sure exactly how to word this question. Whenever I am publishing an entity framework application from Dev to Test and then to production I've always just changed the connection strings located in the app.config or web.config and then updated my .edmx from those dbs (update from database option). Then did my publish or build and move the files over (from my dev machine).
However, I'm not sure that this is necessary or the correct way of doing it. Is there a better/correct way of doing this?
And if it is a term that I can just lookup, let me know that. I can do the research I'm just not sure how to word it.
In the project(asp.net MVC) it is using Entity Framework 6.
I moved a team project collection to a new server. Everything is fine in Visual Studio and the web site, but the build is trying to retrieve source code form the old server.
In the build definition I see no place to set the collection URI. There is a System.TeamFoundationCollectionUri variable but it's read only, trying to set it in Variables causes an An item with the same key has already been added. error on build.
Trying to add a new mapping in Repository works so the (web/app) server is aware that the source code moved, but the old location seems to be left somewhere in the build definition.
Is there any way to fix that? Without re-creating all build definitions I mean.
There is nothing visible in the web interface, but you can see the server name in the TFS SQL database. The column Repository is a nvarchar(MAX) containing all the mappings and the server name.
I fixed the server name with a replace in SQL and it works now.