I am using Visual Studio Reporting Services to create a report that has object binding (and not SQL database). I have created the following class that contains the objects that need to be imported:
public class Paper
{
int m_grade;
public Paper()
{
m_grade = 1000;
}
public int Grade
{
get { return m_grade; }
}
}
This works fine when I initially bind my report to this class. However, if I add any more methods to this class, such as:
public Paper()
{
m_grade = 1000;
int m_mydummy1 = 12;
}
and add another property
public int MyDummy
{
get {return m_dummy1;}
}
it does not get updated in the DataSet that has been automatically generated by the Report Wizard due to which I am unable to add more data/methods to my Reporting Table embedded in the Report. The same happens if I add another Class within the Parent class.
Is there a way around this preferably without having to write code?
Thank you!
These steps worked for me:
Remove data set
Close and reopen Visual Studio
Add data set again
I'm using VS 2013 ultimate.
Fixed. The problem was with Visual Studio not being able to update internally generated datasets for tables/charts/ etc. To update them, go to the report. When the report is active, The "Report" menu will show up in the menu bar. Go to View->Report Data. This opens up a side pane with datasets that are being used internally. right-click on the dataset you wish to update and click on refresh. This pane can also be used to add new datasets to organize data for charts, tables , etc.
With a .Net SQL Server Reporting Services report we often use an object as a datasource but sometimes a newly added property in the object isn't visible in the report's DataSet
Here are the steps I followed to fix this for my report:
Open up the report in Visual Studio and then show the Report Data window - View - Report Data or Ctrl-Alt-D.
Expand the DataSources and DataSets branches.
Right-click on the DataSet you're using and select Refresh.
If this doesn't bring in the new field, do a Clean and Rebuild of the Project which contains your object and try again.
If this doesn't work, delete and re-add the DataSet, making sure to call it the same as before for whatever logic binds the report to the DataSource at run time.
If all the above doesn't work, delete the DataSet and then delete all the DataSources too before re-adding the DataSet again.
If you want to look under the hood at how the report is hooked up, do a search for <TablixCell> in your report project and it will take you into the rdlc (Report Definition Language - Client) file, there doesn't seem to be another way to open this even if you show all files, unless you open it from explorer. If you then search for your DataSet name you'll see how a few steps which I'll explain:
You can see the DataSet name references the DataSource name, and this in turn references the DataSourceID.
If you look at the properties of the project containing your object and then select the Assembly Information, you'll see that the DataSourceID is the Guid shown near the bottom of the page.
It looks like Visual Studio has some sort of bug here (hopefully addressed by SP1) where these bindings get broken. Removing and re-adding everything clears out all the redundant DataSources seems to resolve this.
<DataSources>
<DataSource Name="CodeGeneratorData">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection /</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>fc9a4d7c-55c6-4f10-9e21-7c9eb5ef7996</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="CodeGeneratorDataSet">
<Query>
<DataSourceName>CodeGeneratorData</DataSourceName>
<CommandText>/ Local Query */</CommandText>
</Query>
Related
I need to change the destination of an SSRS report in Visual Studio 2010 so that when I deploy it, it goes to the correct folder. There appear to be about 6 or 10 places where I can change options, I just cannot seem to find the right place to change these deployment options.
On this particular report, there are two subreports. I would like to deploy these two reports to a separate (subfolder) under the folder which contains the main report. I assume that the changes I make in #1 are for SSRS, not for a particular report (is that correct). If so, I will need to change the path for those subreports as well.
Once I have the reports deployed to the correct folders, how do I change the path to these subreports in the Visual Studio report designer? Right now, the reports render properly in the report designer, but when I go to the report server and run the main report, the subreports do not render properly.
I expect this report, along with its sub-reports to render properly from the report server.
You can only change the deployment path in the project properties, so this affects all reports. I did try to setup a similar scenario to what you want bit to be honest it was more trouble than it was worth.
What I ended up doing was having all subreport names start with an underscore and then running a quick bit of t-sql to hide them. I don't have access to the server now but the t-sql is something like
USE ReportServer
UPDATE dbo.Catalog SET Hidden = 1 WHERE LEFT(Name, 1) = '_'
The other way you can do this is to dump all the reports in the same folder but don't give users access to it. Then Create a new folder and add linked reports in there that point back to the original versions, you can do this using the Web Portal (report manage in older versions). It's a pain as you have to do each report individually. You could probably write a script to create the catalog items for you but I've not tried that so can't comment on how easy that would be.
So, saving the subreports to a different folder was straight forward, once I figured out where the project properties were located. Once I deployed those to subreports, all I had to do was change the path to those subreports in the design view of the main report.
Right click on the sub-report, select subreport properties and enter the full path to the sub-report.
Working with TFS 2010 Power Tools, and able to edit template Fields via Process Editor.
However the Fields tab in the editor does not show "all" fields in that Project Collection.
For example if you create a field CompanyName.FooField in Team-Project-A, you will not see it when opening the Process Editor for Team-Project-B within the same collection.
Yet, you are not allowed to create a new field with the same Name or RefName. TFS insists on Name & RefName to be unique in the Project Collection.
You are allowed to create a New field in Team-Project-B using the same Name & RefName for FooField - I'm assuming field is somehow re-used across 2 Team-Projects.
After doing some research, TFS allows for fields to be re-used as long as they are within the same Project Collection (can be in dif. team projects).
Work Item Field Explorer (Tools/ProcessEditor) shows a READ-ONLY view of all fields.
Its obvious that TFS maintains a "Global" Field definition on the Project Collection Level, yet there seem to be additional association with individual Team Project.
It would be extremely helpful if there was a similar way to EDIT all fields at once within a Project Collection as opposed to bouncing between Process Editor windows for each Team Project.
Is there anyway to do that or has anyone faced a similar problem?
It is impossible because two collection projects are necessarily created on two different data bases, so the difficulty of achieving what you want, but betweentwo projects it is possible because they are on the same database instance.
link : http://msdn.microsoft.com/en-us/library/vstudio/dd236915.aspx
How do I update a Linq to SQL .dbml file?
There are three ways to keep the model in sync.
Delete the modified tables from the designer, and drag them back onto the designer surface from the Database Explorer. I have found that, for this to work reliably, you have to:
a. Refresh the database schema in the Database Explorer (right-click, refresh)
b. Save the designer after deleting the tables
c. Save again after dragging the tables back.
Note though that if you have modified any properties (for instance, turning off the child property of an association), this will obviously lose those modifications — you'll have to make them again.
Use SQLMetal to regenerate the schema from your database. I have seen a number of blog posts that show how to script this.
Make changes directly in the Properties pane of the DBML. This works for simple changes, like allowing nulls on a field.
The DBML designer is not installed by default in Visual Studio 2015, 2017 or 2019. You will have to close VS, start the VS installer and modify your installation. The LINQ to SQL tools is the feature you must install. For VS 2017/2019, you can find it under Individual Components > Code Tools.
To update a table in your .dbml-diagram with, for example, added columns, do this:
Update your SQL Server Explorer window.
Drag the "new" version of your table into the .dbml-diagram (report1 in the picture below).
Mark the added columns in the new version of the table, press Ctrl+C to copy the added columns.
Click the "old" version of your table and press Ctrl+V to paste the added columns into the already present version of the table.
Delete the dragged table from step 2 and save the .dbml file.
You could also check out the PLINQO set of code generation templates, based on CodeSmith, which allow you to do a lot of neat things for and with Linq-to-SQL:
generate one file per class (instead of a single, huge file)
update your model as needed
many more features
Check out the PLINQO site at http://www.plinqo.com and have a look at the intro videos.
The second tool I know of are the Huagati DBML/EDMX tools, which allow update of DBML (Linq-to-SQL) and EDMX (Entity Framework) mapping files, and more (like naming conventions etc.).
Marc
We use a custom written T4 template that dynamically queries the information_schema model for each table in all of our .DBML files, and then overwrites parts of the .DBML file with fresh schema info from the database. I highly recommend implementing a solution like this - it has saved me oodles of time, and unlike deleting and re-adding your tables to your model you get to keep your associations. With this solution, you'll get compile-time errors when your schema changes. You want to make sure that you're using a version control system though, because diffing is really handy. This is a great solution that works well if you're developing with a DB schema first approach. Of course, I can't share my company's code so you're on your own for writing this yourself. But if you know some Linq-to-XML and can go to school on this project, you can get to where you want to be.
I would recommend using the visual designer built into VS2008, as updating the dbml also updates the code that is generated for you. Modifying the dbml outside of the visual designer would result in the underlying code being out of sync.
There is a nuance to updating tables then updating the DBML... Foreign key relationships are not immediately always brought over if changes are made to existing tables. The work around is to do a build of the project and then re-add the tables again. I reported this to MS and its being fixed for VS2010.
DBML display does not show new foreign key constraints
Note that the instructions given in the main answer are not clear. To update the table
Open up the dbml design surface
Select all tables with Right->Click->Select All or CTRLa
CTRLx (Cut)
CTRLv (Paste)
Save and rebuild solution.
In the case of stored procedure update, you should delete it from the .dbml file and reinsert it again. But if the stored procedure have two paths (ex: if something; display some columns; else display some other columns), make sure the two paths have the same columns aliases!!! Otherwise only the first path columns will exist.
Here is the complete step-by-step method that worked for me in order to update the LINQ to SQL dbml and associated files to include a new column that I added to one of the database tables.
You need to make the changes to your design surface as suggested by other above; however, you need to do some extra steps. These are the complete steps:
Drag your updated table from Server Explorer onto the design surface
Copy the new column from this "new" table to the "old" table (see M463 answer for details on this step)
Delete the "new" table that you just dragged over
Click and highlight the stored procedure, then delete it
Drag the new stored procedure and drop into place.
Delete the .designer.vb file in the code-behind of the .dbml
(if you do not delete this, your code-behind containing the schema will
not update even if you rebuild and the new table field will not be included)
Clean and Rebuild the solution (this will rebuild the .designer.vb file to include all the new changes!).
Use Visual Studio 2019 open DBML files in graphic designer to update DBML files.
when not working:https://developercommunity.visualstudio.com/t/dbml-files-not-opening-in-graphic-designer-in-vs-2/1659675
Just for the record
Greetings!
I am going through Brad Abrams' SL4 + RIA Services series. Right now I am here:
http://blogs.msdn.com/brada/archive/2010/03/15/silverlight-4-ria-services-ready-for-business-exposing-data-from-entity-framework.aspx.
When I get to the "add domain service" step and the wizard asks you what entities you want to expose, the list is empty. The dropdown that let's me choose my Entity data context is there and the "DishViewEntities" is selected but it is not showing the "Restaurant" and "Plate" entities in the list below like it does in the picture.
I found this thread here:
http://forums.silverlight.net/forums/t/168724.aspx.
The poster has the same problem as me. I have restarted VS, rebooted, regenerated the EDMX, tried creating it in different folders. Still the list is empty. When it is empty, it will not allow me to select individual entities or generate the class.
Any ideas from the community? Thanks!
I had the same problem. I looked for answers on web, they all seemed to relate to installing the RiaServicesToolkit, or other packages, or the dbml confirguration string. But I noticed that when I was opening my Linq2Sql (dbml) in visual studio that I was getting a message about the configuration string missing or incorrect.
It turns out that the configuration string problem was the result of my SQL Server Agent being set to Manual instead of Automatic in my Services (Control Panel). Once I corrected this, the configurations string problem went away.
I don't know if that is also what was causing my RIA (Linq2SQL) problem (although I do see how it could), but after fixing this, and cleaning & rebuilding the solution, my Linq2SQL context appeared on the drop down list of the DomainService wizard and all was golden.
Hope this helps.
This happens from time to time in my project. I don't really have to create a new project (which would be very unfeasable.) I usually make sure the project builds (clean/rebuild) and right-click on edmx file and do run custom tool. And make sure that no errors are being reported on Error and/or Output windows.
We solved our problem. Sometimes EDMX designer can't map Entities and tables. Right click each entity and select table mapping then ensure if all of your entities are mapped correctly.
When you want to add Domain Service Class an exception occur but (I don't know why) the exception message doesn't display. Than the list is seen empty.
If all of your mappings and web.config settings are right after rebuild progress domain service class addition works fine!
So I have my edmx made.
Then I change my database a little bit, changing a column to from being a NOT NULL to allowing NULL.
I go into my edmx, right click and choose "Update Model from Database"
Now I go into my program and it hasnt actually updated... I can't put a null in the column. What do I have to do to update the edmx properly? Thank you.
Update/delete from the EDMX is not always functional. If the model doesn't get updated on clicking Update Model from Database let's say when you have updated a view/table in the DB, do the following:
1) Delete the view/table from the model diagram
2) Switch the EDMX to xml view (right click the edmx file and select "Open With")
3) Search and delete the xml entity elements
4) Switch back to EDMX view
5) Click Update Model from Database
This should reflect any kind of change you made to the DB to your EDMX. It's cumbersome, but works flawlessly.
In an ideal world, i would expect the Update Model from Database to sync the changes from DB to EDMX. But, it doesn't work most of the time.
What I have successfully done is this (VB.Net).
make updates to the database as desired/ required
Choose "Update from database" in the EDMX model, the graphical model will correctly show the new structure/tables
Expand the project so that it shows all related files
The two files with the "tt" extension are the ones that matter: first take the one WITHOUT the .Context. before the tt extension. right click on it and choose Run Custom Tool:
Do the same for the .tt file with the .Context. in its name. All of your code and logical model classes will be updated.
Choosing the Update Model from Database is the best method for updating your EDMX. There are certain properties that don't get updated on the Conceptual layer.
Ensure that your Store layer has been updated by viewing it in the Model Viewer toolbox. If the Store has properly been updated then you're okay, and your database is in sync. If so, go into the visual designer, click the field, go to properties, and update the NotNull property on the Conceptual side.
Yes, It doesn't work most of the time :-/
The "best method" (because it works systematically) is to delete the EDMX file and generate it again.
But don't forget to remove the connection string in App.config (else VS2008 wizzard will add a suffix to the default entity name), and clear the cache.
I hope that these tools will work better in a next release, because it decreases the productivity dramatically...
THIS IS THE QUICKEST EASIEST WAY:
Delete the view/table from the .edmx diagram.
NOW use the Update Model from Database to add the table back in.
1.Build the project after updating EDMX file.
2.Right click your .tt file in solution explorer.
3.Select "Run Custom Tool" option.
This will update the .tt file.
Source : here!
Open the edmx file in the VS's XML editor and check to see if there were errors genned when the update was attempted.
<!--Errors Found During Generation:
warning 6013: The table/view 'foo.dbo.snafu' does not have a primary key
defined and no valid primary key could be inferred. This table/view has
been excluded. To use the entity you will need to review your schema,
add the correct keys and uncomment it.
<EntityType Name="snafu">
<Property Name="snafu_column" Type="smallint" />
</EntityType>-->
In the above case...Adding a primary key to the table in question caused the "Update Model from Database" to work.
This answer is better: https://stackoverflow.com/a/23886016/1014884
Any manual editing is ripe for errors or will be lost when someone uses any tool like the wizard. Deleting and updating with the wizard is much better.
It doesnt update for example max length for string attributes!
If you work with TFS it is not good to delete the file, you want to keep the history and not affect others.
For me it works having a tiniy separate project that I can use to completely recreate the edmx file, I open it in xml, copy paste to the existing one, and move one shape in the model in order for VS to recreate the .cs file. Voila, it is now updated.
A view I created in the database was not appearing in the designer (after choosing "Update model from database..." and adding a check next to the name of the view). I saw no error message until I switched the EDMX to xml view:
Right click the edmx file
Select "Open With..."
Select "Automatic Editor Selector (XML)"
Click Find and search for your view name
In the edmx xml I found:
"Errors Found During Generation: warning 6013: The table/view '(view
name)' does not have a primary key defined and no valid primary key
could be inferred. This table/view has been excluded. To use the
entity, you will need to review your schema, add the correct keys, and
uncomment it."
I modified the view to have a primary key. Then I opened the edmx designer and ran "Update model from database..." and the view then appeared in the designer as expected with no errors.
Removing all tables from designer view and Updating after that works for me