Hi
I'am taking my first steps with Linq and it looks realy fine. It's a real benefit in showing the right data.
But when i look at my code, i wonder whether the way i did it there's still a connection to the dataset. It shows the right data, but what's gonna happen when i modify, delete or add data.
The eCUWorkpiecesBindingSource2 i use is bound to a ultraWinGrid and is filled with the data by the code i added (as shown further down on this page).
Sorry for my attempt to ask in this confuse way. I wanted to know if i am working correctly on a typed dataset or if i am missunderstanding the right way using linq with a typed dataSet
Thanks for your support
Greetings from germany
Dietrich Schomberg
DataTable workpiecesTable = ecu_managerDataSet.Tables["ECU_Workpieces"];DataTable workpieces2LocationsTable = ecu_managerDataSet.Tables["ECU_Workpieces2Locations"];var query = from workpieces in ecu_managerDataSet.ECU_Workpieces.AsEnumerable() join workpieces2Locations in ecu_managerDataSet.ECU_Workpieces2Locations.AsEnumerable() on workpieces.ID equals workpieces2Locations.WP_ID where !workpieces2Locations.IsAggreedToECUNull() && workpieces2Locations.AggreedToECU == nodeID && workpieces2Locations.IsEndDateNull() orderby workpieces.Abbreviation select workpieces;DataTable dt = new DataTable();if (query.Count() != 0){ dt = query.CopyToDataTable(); }eCUWorkpiecesBindingSource2.DataSource = dt;
When you add, delete or update data, it will be updated only in the DataTable. There is no way for the DataTable to update the database itself. The only objects that can do it are the Command and the DataAdapter object.
That's what i thought. That the connection to the dataset is gone if i do this like this.
But what might be best practice when i have to filter the visible data over two and more datatables, when i have to show the data of one datatable at the same time in different "ways/views" cause i have parent/child relations in datatables itself...
When i wanted to fill the dataset once and select, add, modify this data in the datasource only.
For me it looks like a conceptional thing that isn't quite clear to me.
Thx so far!
Sorry but I don't understand what you want to do. Can you explain what your program should do?
That's quite a lot of help. I think that this will take me a while to understand.
But it's great getting the terms for the right direction the application should be going to.
I appreciate it a lot getting this much of help
Thx very much
Well, there are a lot of best practices involved here. Using one dataset is usually a good idea, although I thing using datasets is much less easier than Linq to Sql or Entity Framework.
I can give you some advices about data binding:
1. Use a UserControl for each grid or several editors.
2. Don't put all controls in one place in the designer even if they are put in user controls. Make your user controls and put them in the form in runtime according to what the user want to see right now.
3. Don't bind to an empty/null/not loaded entity or collection. That can suspend your binding.
4. Use IBindingList and don't bind your list directly.
Sorry, sometimes it isn't quite easy for me to explain it in german. But i'll try.
OK!
I'd like to have an easy way to load, add, delete and modify data.
The latest version of the application uses 3 datasets to hold the data i wanted to show.
As an example: i have 3 datasettables workpieces, each has its own bindingsource which i fill though my tableadapter with different data i wanted to show in each of my grids.
one table holds all workpieces. this table is used for a comboboxanother table holds the parent workpiecethe last table holds all childs of the parent workpiece
Now i think that this is a little bit stupid an i wanted to use a single dataset and different binding sources to get the same effect.Cause the old way i had to save all modified data when the user changes the view by clicking on a different workpiece. The applications checks for modifications and afterwards the datasets were filled again.
I thought that a single dataset might be easier to work with. Easier in working with modified, added or deleted data. Cause the user could save his work by hitting the save button when ever he wants to.
- i wanted one dataset for holding my data
- all grids, combos, textboxes or treeview should show the data i wanted to show; therefore they should all use the same dataset
- the different views should come from different bindingsources filtering the data the way i wanted to see it
And what i don't realy know is:
- if it's overall the right way or am i trying it the wrong way
- what might be best practise
- what technical terms i should "google" to get a propper idea in doing the right thing
At least there is the duty to exchange all former componentOne controls with infragistic controls, getting the treeview-comboboxes i formally had,...
The applications is about simple warehouse management, but with tricky database-tables, monster sql-queries, storedprocedures,...
and has to work the quality center toolbox. For which we developed a VisualBasic frame as a .net container for c# usercontrols (but that's the easy part, but i must admit that the ribbon-buttons (like the c1 ribbon) don't gets the mouse-over-effents)(=>browser-quality center-visualbasic-c# usercontrol,...)
:-)
and still 2 week till deadline but what about a 40hours/week busines when you can have 60hours/week to get the job done
i hope it's not only nonsense what i wrote. My problem seems to be like in former times when i used to search information about "regular expressions" but i don't know that the technical term is "regular expression"... it costs a bunch of time till i get the right term and the right informations.