WCF RIA, Silverlight 4 - silverlight

I am working on a Silverlight 4 project. I am using WCF RIA on the server and expose the model using a DomainService. I have 2 tables, let's say Table1 and Table2 linked with Foreign key say FID.
Therefore, i can Load data from both table 1 and table 2 in single data grid.
But my question is while editing datagrid if i need to change foreign key's Link, let's say row 1 is linked to foreign key FID1 and I want to change that link to FID2. In same time i want change the content of table 2 in data grid on that row.
Example
datagrid1[ID1 Name Add FID1 F_post F_Name] => [ID1 Name Add FID2 F_post2 F_Name2]
Thanks

I don't see the problem ...
Have you used the automatically generated data source templates?
That should automatically set the linked object as something like a drop down list.

Related

Handling Onload events to add server side logic in ADF

I want to know how do we handle onload event so that we add some business logic once a view is loaded.
In brief this is what i want to achieve -
I have a entity object which i am showing as editable ADF table. Now once the page is loaded and I want the table to show at least 4 rows no matter how many rows exist in Database table. For example, if database table has 2 entries then ADF table should show those 2 rows and additional blank 2 rows in ADF table. And if the database table has 6 rows it should show 6 rows in ADF table.
How to programmatically handle this functionality. What functions and methods i need to override or add.
Any help is appreciated.
Thanks.
There are multiple ways of doing this, including doing this in a method call in the taskflow before you reach the page.
Some options:
https://blogs.oracle.com/adf/entry/an_epic_question_how_to

ADF BC composite ViewObject based on 3 entities - insert

Is it possible to insert a ViewObject that is based on 3 entities? Or just view and update?
I created ViewObject that is based on 3 entities. All entities have foreign keys and associations between them. Selecting and updating this composite entity works fine. But insert doesn't. ADF version 11.1.2.3.0
When you created your VO, did you mark the second and third EOs you added as updateable?
Note that if the realtionship is 1 to many you might need to code what to do in an insert situation.
More on this here:
http://docs.oracle.com/cd/E35521_01/web.111230/e16182/bcadvvo.htm#CEGCAJCI
42.9 Creating a View Object with Multiple Updatable Entities

Fail to update relational table in access database using VB.NET

I am using access as my database in vb.net
I am using the drag and drop datasource approach to set up its dataset, data grid view , table adapter, table binding source.
I have two table , A and B
A is the parent table, B is children table
So there is a foreign key (say A.id )in B
When i tried to edit A and save it.
There will be an error come out.
It told me that B has a related record of A,
so i cannot modify or del A
I feel very confused of what it means
I did not edit column id in A (which is a foreign key in B) , i just edit others column
I don't understand why i still cannot save it
When i try to save :
the tableAdapterManager is using UpdateAll Method to update whole dataset
I tried to use the tableAdapter of A and B to update their individual dataset.
It comes out the same result no matter what the order of tableAdapter update method is
Really thanks someone who can answer my question :):)

Adding an order for a customer selected from a list view in Access

I followed this great guide to help me add a search feature to my Access database:
http://www.techrepublic.com/blog/howdoi/how-do-i-populate-an-access-list-control-with-the-results-of-a-dynamic-search/108
At the end it says:
"If you’re building a quote or order, use the list control’s Click or Double Click event to copy record(s) to a temporary table. It’s easy to implement using a fixed query for each search task."
I have managed to display all search results in a list box and I would like to be able to click on a customer to highlight them, and then press a button to add an order to the selected customer. I've been thinking how I could do it and I really can't get my head around it.
Any help would be appreciated.
It depends on how you build your database. My guess is that one easy way would be:
Create a table with customers;
Create an "Order" table with orders where you link the customers through a foreign key
You load the customers in a listbox. While making the name visible, it is actually the ID that you retrieve when clicking the listbox. You can configure this via the wizard in the design view of a table. You can make other forms appear by events on the listbox (eg. on click).
If you managed to retrieve the ID of the customer, and you have the data related to the order (data that can easily be extracted from form objects and loaded into variables ) what you need is an insert statement and insert the values in the "Order" tabel (including the customer ID, which is linked through the foreign key).
This way all order records are linked to the customer and can be queried later.
Due to my limited knowledge on your other requests, I cannot help you any further on the rest of your database design.
I hope that my reply could help you and that I understood your question correctly.
You can access info from a listbox via:
List.Value
Or if it is not the first column then:
List.Column(0,0)
0 being the column and row references.
You may also consider using a listview over a listbox and then you can access the relevant parts of a listview control with the following code:
ListView.SelectedItem
Or if it is not the first column then:
ListView.SelectedItem.SubItems(3)
3 being the column reference

Implement a simple many-to-many relation in a Form in OpenOffice.org's Base

I'm doing a small relational database, to be used by one person on a single computer. I chose OpenOffice.org's Base (version 3.1.1) because it's free and should be more than enough for this case. The simplified version of my problem is:
I have an Articles table, with columns: ID, Title, Content, etc....
I have a Keywords table with columns: ID, Keyword.
I have a Relations table with columns: ID, ArticleID, KeywordID
Just a basic, classic, example of a many-to-many relation.
Then I created a form (for the user using the database) using the 'Design view' in Base and linked to the Articles table, which works fine, and allows me to view, edit and created rows in the Articles table.
My problem is how to include the relation to Keywords in that same form. That is, I want the user to be able to view and choose which keyword(s) belongs to the article currently being viewed in the form.
The number of keywords is finite (probably 5-15) if that matters. A preferred setup would be a list of keywords (dynamically linked to the Keywords table of course) in the previously mentioned form I've already created with a check box in front of each keywords
I've tried Google'ing all possible keywords and I've come up with nothing applicable to my case. I belive the answer is somehow using SubForms, or maybe some SQL syntax I'm not familiar with. Any help appreciated.
To answer this in a little more detail, as it comes up early on Google search, please refer to the following video of creating the movies.odb file from scratch:
http://www.youtube.com/watch?v=GYawYO8u3_s
Some further notes on creating this:
Setting up the tables
The principle tables must have an integer primary key that is set to AutoValue
The linking table must have a multi-column primary key, and both columns must be integers
The table relationships must be set in the Relationships... dialog
The relationships disappear if Update options not changed from No action
Setting up the subform
The subform Data >> Content must be set to the mapping table
The subform Data >> Link master fields and Link slave fields must be set to the related fields (as per the Relationships... dialog discussed above)
A table control should be draw (focus must be on the subform at the time, such that the table control sits below the subform in the Form Navigator
A column should be inserted into the table control
The column Data >> Data field should be set to the ID of the related data (i.e. not that of the main form)
The column Data >> Type of list contents should be set to “sql”
The column Date >> List content should be set to “SELECT “Genre Name”, “GenreID” FROM “Genre”” (where Genre Name is the relevant field from the related table, the GenreID is the primary key of that table, and Genre is the related table)
I did some more searching and finally found a solution.
A thread explaining this very issues (among other issues), creating form for a database containing many-to-many relation in Base using a middle table, can be found at:
http://user.services.openoffice.org/en/forum/viewtopic.php?p=16159#p16159
A sample database with a functional form by one of the above thread's posters (DrewJensen) can be found and downloaded at page 2 of the above posted thread. (named movies_2.odb)
A brief description of the solution using my example tables and columns from orginial post:
The trick lies in creating a sub-form linked to the Relations table within the form I had created. That sub-form should contain a Table Control. Then a column should be created in that Table Control. The column should be asigned to the KeywordID column. The "List content" field for that column should then contain: SELECT "Keyword", "ID" FROM "Relations".
(just check out the above link if my instructions are cryptic)

Resources