Update target button is disabled after schema comparison - visual-studio-2012

I have created database project using VS 2012. Once the schema comparison is done, the update target button should be enabled to sync with target.
But it's not getting enabled. Any help plz.
I'm using VS 2012 with sp 3, SQL Server 2012,

Check the Error List if you have any error, I had a non recognized word in VS (but it did in SQL Server), I commented it out, re-compared and it was enabled successfully.

See if you have a "warning" message stating "Cannot generate deployment plan due to an internal error". If so, the Update and Generate Script buttons will be disabled.
Close Visual Studio, navigate to the folder containing the Database project and remove all (*.dbmdl) files. Then restart Visual Studio, re-run the compare schema at which point the Update button should be enabled.

Workaround:
In my case. Fixing Error was not priority task. Also i was not able to find any Error in Error List.
Its just you dont have to use your "Visual Studio Database Project" in source or target. Instead of using project, create a temp DataBase using script already with you.
Select this (or these) temp database(s) in source and (or) other in target.
Button must be Enabled.
For me getting difference was far more important than fixing the issue. Hope it helps you. With some more improvisation.

It seems your database project has sqlcmd variables without default values.
See:
http://www.andrewburrow.net/vs2012-schema-compare-buttons-disabled/
Hope this helps.

I couldn't see any errors in Error List, but I could see the errors in the Output tab

the everytime you open the "options" on "schema comparison" you must click on "compare" button again to activate the "update" button. However if it doesn't work at the first time, just close and reopen the Schema comparison file again.

For me, there were no errors visible in the Error List. This was because I had the "Show Issues Generated" drop down was set to "Build Only"; changing it to "Build + IntelliSense" allowed me to see the SQL errors that needed to be fixed to enable the Generate Script and Update buttons.

In SSDT I had the case where the update button was enabled but the generate script was not enabled. This was because my destination schema was my local solution (the *.sqlproj vs project).
It took a few minutes to dawn on me that the destination needed to be a real database to correctly generate the script.

And after all, when you have the available Update Target button and the disabled Generate Script button.
See if your source is a database and your target is your SSDT project.
If so then click "Switch source and target" button.
The Generate Script button will become available.
I.e. a SSDT project must be the source and a database must be the target in the Schema Compare window.

Workaround 2:
In my case, the Update button was greyed out because of there were errors warnings about a view that I created and added to the project earlier.
The problem was that the view was scripted to use full database qualified object naming. E.g. [databasename].[schemaname].[objectname], which works fine in SSMS, but causes a problem when it is checked in a DB Project.
If you use three part naming for referring an object in same DB project results in a error/warning in Visual Studio.
By changing the code to [schemaname].[objectname] in the definicion of the view removed the error warnings and enable the Update option. Happy days!
Credits:
https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/3577074-allow-three-part-naming-for-referring-a-db-object
https://visualstudio.uservoice.com/forums/121579-visual-studio-ide/suggestions/17396128-keep-update-and-generate-update-script-buttons

Typically the update button is grayed out when the database objects are available in the separate sql files physically inside the database project but are not included in the database project itself. I simply added those sql scripts into the project and the update button got enabled after comparing the schema.

In my case, the Update button was disabled because there was a scalar function that was modified and that function was used in a computed column definition.
My solution was to:
Manually drop the computed column(s) in the database
ALTER TABLE <your table> DROP COLUMN <your computed column>
Re-run the schema compare
The Update button was enabled, and the update completed successfully

Related

How can I use a dialog to define the program group name in Installshield 2015

I am currently trying to expand our installation program with an option for the user to specify the name of the program group where shortcuts are created under the start menu. (I am aware that this is a somewhat outdated concept)
I am using InstallShield 2015.
I created a localizable property named [PROGRAMGROUP_NAME]. This has automatically created an {ID_STRING46} which I've set to the desired default value. So far so good.
I managed to create a custom dialog with an edit control, which is linked to the above property.
Now comes the tricky part: Under Shortcuts, under "Programs Menu" I first want to add a folder with the program group name, under which to place several shortcuts.
If I enter [PROGRAMGROUP_NAME] that is literally what the name becomes. If I use {ID_STRING46}, it uses the default value, and not what I've entered in the dialog.
Incidentally, when I tried to rename ID_STRING46 to something more meaningful, other things started going wrong so I've left that as is.
What is going wrong here? How do I get the value of the property to be used for the folder name?
EDIT
I am trying to use a custom action now, but I have trouble defining it. My Dialog that sets the property is after CostFinalize, so I assume I have to use SetDirectory - but I have trouble defining it. I get an error stating "could not access network location "
EDIT
I've managed to progress a step. I have manually added a directory with key DIRECTORY_PROGRAM_GROUP (important that it's all caps to make it public) to the directory table. Then, I use a custom action to set that directory to the desired value [ProgramMenuFolder][PROGRAM_GROUP_NAME] after I've run my dialog, and I've modified the shortcut to be created in that folder.
Seems to work great, however, now the program group is no longer removed when uninstalling...
Shortcuts are installed to folders, and the name of the folders below ProgramMenuFolder become the program group as you describe it. So you will need to either build up the Directory table (either directly---note that the DefaultDir column is localizable, and there may already be a string you can update---or through the Files and Folders view) to do what you want, or use custom actions (set property, if before costing; set directory, if after costing) to adjust the location to which your shortcut is installed.
As for the problems renaming ID_STRING46, odds are you didn't update a reference after you changed the name of the string. The simplest way to track down where these are may be to examine differences in the built installer (perhaps using InstallShield's MSI Diff) and then update the relevant references using the direct editor if you can't find them in the normal views.

VS2012 SSRS Cannot See Data Fields

I have a VS2012 SSRS report project with a shared data set. The data set is being created from a SQL Stored Proc. I used to use VS2008, and all of the available data fields would show below the data set, however, in VS2012 I cannot figure out how to get them to show. I've removed the data set, and added it back, I've completely removed the DataSource and added it back, nothing works.
The original report file was built in VS2008, and was converted to a VS2012 project. Not sure if this could be contributing to the problem.
Thank you.
Your screen shot shows the Solution Explorer pane. Data Fields never appeared in this pane, in any version of SSRS.
I suspect what you are looking for is the Report Data Pane, which you should find on the View menu
https://msdn.microsoft.com/en-us/library/cc627528(v=sql.120).aspx

Which Visual Studio project types support Shift+Alt+D to open the Data Sources window?

In Visual Studio 2012, it appears that only maybe a third of the 20 or so C# project types support using Shift+Alt+D to open the "Data Sources" window (and none that I've found ever display the mythical "Data" menu bar option).
Is there any sort of guide as to which project types will allow you to work with data sources?
Also, is there any way to "adjust" the features of a project after it's been created?
Update: See my answer below for how to add the Data Sources function to an existing project.
I believe you are looking for this page:
http://msdn.microsoft.com/en-us/library/yft2c9ad.aspx
To quote msdn: "You can add a data source to a project only if it supports creating and working with data sources. For example, you can't open the Data Sources window in a project for a Windows Store app."
Basically, if using a database seems logical in your application, you can probably use one.
To answer your question about the "mythical 'Data' menu bar option", here's how you access it:
You just have to select "View", then "Other Windows", and finally "Data Sources"
And to answer your final question about, "Also, is there any way to 'adjust' the features of a project after it's been created?"
Yes, yes there is. If you mean as a compiled executable, one could simply decompile the project or use an ILcode editor. If you mean as a solution in visual studios, using the solution explorer you can access "My Project" and simply double click that to get a nice little gui for adjusting your project.
EDIT:
For an overload of information about data in visual studios, you can visit: http://msdn.microsoft.com/en-us/library/wzabh8c4.aspx
For more information about just the data source window, you can visit:
http://msdn.microsoft.com/en-us/library/6ckyxa83.aspx
Aha! There is a way to add data access to a project that lacks it, per: http://msdn.microsoft.com/en-us/library/bb907587.aspx. To quote:
To create a class from a database table
If you are working with a Web site project, and the project does not already have an App_Code folder, in Solution Explorer, right-click the project, click Add ASP.NET Folder, and then click App_Code.
In Solution Explorer, right-click the App_Code folder (for a Web site project) or the project (for a Web application project) and then click Add New Item.
Under Installed templates, select Linq to SQL Classes template, type a name for the .dbml file, and then click Add.
-- The Object Relational Designer window is displayed. [Note that this is the window that Shift-Alt-D displays]
In Server Explorer, drag the database tables or other objects (such as views) that you want to use with LINQ to SQL into the Object Relational Designer window.
-- The tables and their columns are represented as a entities in the designer window.
Save the .dbml file.
This creates .designer.cs or .designer.vb file that is located under the .dbml file. The file contains a class that represents the database and a class that represents the table. The parameterless constructor for the database class reads the connection string from the Web.config file.
(Note that, after performing this procedure you may get a message "The type or namespace name 'Linq' does not exist in the namespace 'System.Data'". The solution to this problem is found here.)

Update database with visual studio database projects

Hy,
I'am trying to use Visual Studio 2012 database project to upgrade a database to a newer version but i'am having a weird problem.I select the source database then the target database and hit compare.Visual Studio generates the script with the differences and when i execute it fails because it tries to drop tables without first dropping the FK constraints that are on those tables.(normally it should first script all the constrains from a table,drop them,drop the table,after that create the new table and finally recreating the constraints)
Do you have any ideas why it tries to do directly drop table without dropping constraints first.
Am i missing some settings?
Sounds like a bug to me. Try posting the same question on the SSDT forum.
If you have access to a copy of SQL Compare, it might be worth trying the same comparison to see if this works better. If you're using a database project as a data source, you'll need to select "source control", then "scripts folder", and browse to the folder that contains the .sqlproj file. Here at Red Gate we're working on improving database project support in SQL Compare so we'd welcome any feedback or questions.
If the tables that are being dropped in your database are not in your schema definition and you have got the "DROP objects in target but not in project" option selected in the Deployment Options, then it will try to drop them.
Have you checked this is not the case?
Whenever i work with database generating code from data models, or scrips, i often get that problem, so i have an script just for deleting those keys, sometimes i have to drop my database manually rather than executing the query, because most of the times it does but not completely, so i first dro the database, generate the script and run the script just for erasing the keys

Visual Studio 2012 SSDT - How do I create/manage tables now?

I'm trying out Visual Studio 2012 and so far it's good but I created database project, added database *.mdf file to my App_Data and tried to create simple database with relations and I have no clue what to do next. I can't even name my database.
http://msdn.microsoft.com/en-us/library/hh272680(v=vs.103).aspx - AFAIK this article shows how to add relations but I can't find any Foreign Keys node. And also, why can't I edit name? VS2010 database management was so easy and intuitive, now I don't understand how to work with it.
More visual representation of my question and my simple table for example.
Table name you can change in Properties window:
relations by right clicking on Foreign Keys:
You can also modify sql in lower pane - all changes will be reflected in graphical tools. I'm find this useful e.g. when I want to copy some columns from one table to another.
You can also make changes on database with another tools, like SSMS (better FK tools I think) and then import this changes via Schema Compare by setting database as source and project as destination.
Right click on the database where you like to execute the query and then select add new query and execute the following query in it.
sp_rename 'oldtablename','newtablename'
Not so far. Right clic on this element.
check out this answer: Visual Studio 2012 Database Designer - Has the functionality changed?
I'm new to sql anyway if you right click the toolbar there is a "table designer" set of buttons but are all grayed out. Not sure if to initiate them the db must be Online.

Resources