I currently have a DataSet that has several tables in it for a C# Windows app. I have one parent table and all of the other tables in this set are child tables that have a relation to the ID column in the parent.
I just recently added a new table and made the necessary relation to the parent table through the wizard and designer, not coding. However, when I go to my form and try to change the DataMember on the property screen of the BindingSource, it doesn't find the relation that I just created in the drop down menu. I try to manually input the name of the relation and I receive the error message listed in the title.
I've never had this issue before when I have added child tables to the DataSet and then changed the DataMembers for them so I'm not really sure where to go from here in order to resolve this issue. Any assistance would be awesome.
Let me know if you need more information.
Edit: I should also add that it seems to only be happening with this one DataSet. I tried adding the exact same table to a different DataSet I had and everything worked without an issue.
Related
I'm currently working on a project to generate forms from the Umbraco (V.10) backend (I know that there is Umbraco Forms, but this is not an option).
I have a parent Node called "Formular" this generates the <form> tag. The parent can have various children like "Input Form Field", "Date Time Form Field" etc. These create an <input> field.
Document types
What I want to do is to generate a database table from all child nodes of the "Formular" node. The database attribute names should be the node ID.
A child node has a radio list with types like "text", "textarea", "number" etc. to set the <input type="">. If the type is getting changed or a node is deleted, a new table should be generated with the new child nodes. It would be an option to update the table if a new node was added and to set the previous entries to null in this column.
Example table
I thought that I could create a custom section where all child nodes are shown with their datatype and a button that is activated if any changes were made in the nodes. If the button is getting clicked, it generates the new table (maybe the table name could be set in the section too).
If this helps somehow, I can send my form with ajax this is how it looks:
Ajax POST
I tried to create a table with the id and data types which I get from my ajax post, but I realized, that it is dumb to always check if the id and datatype are the same in the table and to create a new one if this is false. So I thought about creating the table directly from the Umbraco nodes.
My problem is, that I don't know how to generate the table if I don't have a model with attributes like "public int ...". And since there is no way to generate these attributes with a loop i have no idea how to create the table.
Any thoughts on this problem?
Thanks
I have been working on that for quite a long time, but I could figure out a better way than creating the database table from the content nodes.
I just generated a table "FormSubmission" that saves a nodeId each time the form has been submitted. Then I created a second table named "FormContext". This one is related to the ID of the submission, and each input field gets saved as one table entry in the "FormContext" table with the submission ID as foreign key.
UML
This way I'm able to select all entries of a specific form and I can select all content a person has entered into the form.
Since I have all types an input field can have in the table, I don't have to update the table when the form changes or one form gets deleted.
I then created the tables like the umbraco documentation tells and just had to insert the data into the tables.
Umbraco creating a custom database table
I know this is not the most beautiful way but it works.
I would like to write a software which shows database contents in a Forms application. To make it easier to explain, I'll use a shopping list as an example.
I have a number of lists in one table tLists
I have a number of tProductPackages in another table
A list can consist of many productPackages and one productPackage can be in many lists. This m:n relationship is reflected in a separate table named tListProdPacks.
A productPackage contains a product. A product can have several productPackages. In every tProductPackage table entry, there's a foreign key FK_ProductID which references an entry in a table tProducts.
My forms application should navigate through all the lists using a BindingNavigator. In some bound controls, it should display the details of the selected list. This is working fine. (Just bound controls.)
All the list contents (entries in tListProdPacks for the selected tLists element) should be shown in a DataGridView. This is also working fine. Also the details of the productPackages (tProductPackages items i.e. one hop more to the next table) are displayed correctly. In this table he product value is available as ID (FK_ProductID) (foreign key to tProducts).
Is there a way to show the product name (contained only in tProducts) in the DataGridView whose DataSource is tListProdPacks?
(It's easy to display tProductPackages members, as the primary key from tProductPackages is referenced it tListProdPacks and using this ID I can show all other details from tProductPackages by just keep using the same valueMember but use different DisplayMember values for the single DataGridView columns [using dropdown controls in the DGV].)
But when jumping one table further (i.e. when jumping to the tProducts table), this does not work anymore.
I know that I could just create a custom query (join, view) to get exactly what I want, but then I cannot update the database from the dataset anymore.
Does anyone konw how to accomplish that?
(I guess that there's some easy way provided by the framework and I just don't see it, right?)
I'm not sure if I was able to describe what I would like to accomplish good enough. If not, please help me what to provide in addition.
Best regards,
Tom
u can relate the tables using joins if they contain primary key foreign key relation . using joins u can retrieve a single result set containing all the fields which u might need.
I have two datasets I need to pull from, A base that both reports use and then a separate one that only one report pulls from. I get the error
Error 12 The Value expression for the text box ‘Textbox9’ refers to
the field ‘Name’. Report item expressions can only refer to fields
within the current dataset scope or, if inside an aggregate, the
specified dataset scope.
My best guess is I have to associate them with the correct dataset but I have not been able to find any documentation on this.
edit: I am trying to access property files that I created for the fields on the report document.
Can someone please tell me where in the rdlc document I need to code something like name.value, "dataset1" or something similar?
When you create a table in a RLDC, in the Tablix properties (selecting a row or a column) you must associate a DataSet.
After doing that, you have to write in each cell the name of the field (in the dataset) that you will use. You can do that by clicking on the "little table" in the cell, when you put the mouse over it
In images (with Visual Studio 2010)
If you don't see the dataset in the list, you must add it.
For that, click on view menu -> report data.
Then, in the DummyDataSource, click Add Dataset..
And select it from the list, or create a new one instead, in the same form.
If this doesn't work, well I don't know haha
If the two datasets has the same structure, then you could use one just, and in the code assign it to the datasource
I ran into this same error and the only way I could resolve it was by closing and reopening BIDS and then refreshing the fields from the stored procedure (Right click the data set -> Dataset Propoerties -> Query -> Refresh Fields).
Thanks for the troubleshooting tips!
If you are trying to embed the results of one set into a table that is using another data set, have you considered a subreport?
After some careful research and error checking I found that I had to create my base model property file and when I drag the actual data points on to my form I had to associate them with their correct set:
I clicked the value and associated the correct dataset.
I'm in C# Express 2010 and SQL Server Express 2008, making a winforms front end for simple table editing. User picks a table from a combobox, and a datagridview is populated with that table. There's a Submit and Reload button at the bottom of the form. It's loosely based on Microsoft's example for binding a DGV to a database.
So, I have this datagridview that is populated by a data adaptor. After it's been populated, I go through the resulting table and replace any columns with foreign keys with comboboxcolumns so it's easier for the user.
This bit all works fine. The comboboxcolumn shows up, with the correct data in it etc etc. I've set the Headertext, DataProprtyName, and Name properties to match the column it has replaced.
It DOES seem to have broken my 'submit' button that does the update command. Basically, if I change the value in one of the comboboxcolumns, I get a concurrency violation. If I change a value in any other column, it silently fails (when the data is reloaded into the DGV, the updated value vanishes).
Any ideas what the problem could be here?
If you need to see code just let me know. There's rather a lot of it as I'm a newbie and have probably done things in a horrendously messy way!
Thanks in advance.
Never mind - I figured it out - I had copy/pasted a procedure and forgotten to create a new DataAdaptor, so it was using the same one as the one used to populate the DGV, hence things went A over T...
I have two local data sources that I can push into the report. Works no problem. But how do I set up the report? One data source contains a list of employees, and info about them. The other contains a bunch of working hours for each employee.
I would like to use a table for the list of employees, and then have another table for the working hours beneath each employee (with their working hours).
Is this even possible? Do I have to use a Sub-Report? Would I have to merge them into one datasource? =/
As far as I can tell, it is impossible to nest one dataset inside of another one without using a subreport.
This means you need to do one of two things:
Refactor your two datasources into a single datasource. For example, perform a join between the employees and the working hours for each employee. You can then use the grouping properties of the Table object to format the list the way you want it.
If joining the two data sources is not practical, you can use subreports to accomplish what you want. Create a subreport containing the working hours data source and give it a parameter for the current employee. Filter the working hours by this parameter.
In your parent report, you can place the subreport in the list, and pass the employee ID for the current row as a parameter.
Note that there are a few formatting quirks involved with using subreports. I've been able to work around them in most cases, but the preferred method would definitely be number one above.
Adding a new answer to make sure a notification is sent for it.
Using a subreport is the easiest method when it works. You can simply drag and drop a subreport onto a table cell, and it will fill that cell's content area. Right-clicking on the subreport will allow you to edit the parameters for the subreport. Like most values in SSRS, the parameters can be set to expressions which use the fields in the table.
Within the subreport, just filter your results to show only the records associated with the employee who was passed in as a parameter.
The other route you can take is to merge your two datasources using a join. This will give you data something like this:
employee1 time1.1
employee1 time1.2
employee1 time1.3
employee1 time1.4
employee2 time2.1
employee2 time2.2
employee2 time2.3
You can then create a group on the repeated columns (employee in this example), and enable the HideDuplicates property on those columns. The result will look like this:
employee1 time1.1
time1.2
time1.3
time1.4
employee2 time2.1
time2.2
time2.3
To set up multiple datasources...you need to place two separate list objects into the report. Go to the designer, and in the toolbox you can put a new "list" into it. Then, you can do another report. Link that second list to your secondary dataset, which you implement through the secondary datasource.
It's a little bit of a stretch, but the basic idea is that each list object in the report can only be linked to one datasource.
In the report document class there is a property called "Database", which has a collection of tables. You can use "SetDataSource" on each one of those tables, in order to place the separate lists of objects into the report.