Advertisement

02.28.2008 at 09:42PM PST, ID: 23202997
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

How to combine results from two datasources?

Tags: Microsoft, Visual Studio, 2008, LINQ
How can I combine results from two data sources?  The problem is that the second datasource result set is the 'current' data in the binding source and the first is the results that are showing in the database.  This problem arose because I don't want to commit the database changes.  Let me know what you think...

The error triggers on the TotalMemberNames Union

ERROR:
Unable to cast object of type '<SelectIterator>d__d`2[VB$AnonymousType_0`3[System.Object,System.Object,System.Object],VB$AnonymousType_0`3[System.Object,System.Object,System.Object]]' to type 'System.Collections.Generic.IEnumerable`1[VB$AnonymousType_0`3[System.Guid,System.Nullable`1[System.Guid],System.String]]'.

Thanks,
john
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
Dim DisplayFamilyMembers = From client In ClientDB.Clients _
                                               Where client.FamilyGUID = GlobalFamilyGUID _
                                               Select New With {client.ClientGUID, client.FamilyGUID, .Name = client.FirstName + "," + client.LastName}
 
        Dim DisplayNewFamilyMember = From client In ClientBindingSource _
                                     Where (client.FamilyGUID = GlobalFamilyGUID) _
                                     Select New With {client.ClientGUID, client.FamilyGUID, .Name = client.FirstName + "," + client.LastName}
 
        Dim TotalMemberNames = (From client In DisplayFamilyMembers).Union(From client In DisplayNewFamilyMember)
 
        MyClientsInFamilyBindingSource.DataSource = TotalMemberNames
Start your free trial to view this solution
Question Stats
Zone: Programming
Question Asked By: jdraggi
Solution Provided By: jdraggi
Participating Experts: 3
Solution Grade: B
Views: 23
Translate:
Loading Advertisement...
02.28.2008 at 10:20PM PST, ID: 21011308

Rank: Guru

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
02.29.2008 at 07:50AM PST, ID: 21014293

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.07.2008 at 02:04PM PST, ID: 21074500

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.07.2008 at 02:25PM PST, ID: 21074658

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
03.07.2008 at 06:58PM PST, ID: 21075662

All comments and solutions are available to Premium Service Members only.

Start your 7-day free trial and see for yourself why Experts Exchange is the easiest and most proven technology resource in the world. Get Started

Already a member? Login to view this solution.

 
 
Loading Advertisement...
Microsoft
  • Internet Protocols
  • Applications
  • Development
  • OS
  • Hardware
  • Windows Security
Apple
  • Operating Systems
  • Hardware
  • Programming
  • Networking
  • Software
Internet
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Spy / Ad Blockers
  • Web Browsers
  • New Net Users
  • Web Development
  • Chat / IM
  • Anti Spam
  • Web Servers
  • Anti-Virus
  • Email Clients
Gamers
  • Tips
  • Online / MMORPG
  • Puzzle
  • Emulators
  • Action / Adventure
  • Role Playing
  • Consoles
  • Game Programming
  • Strategy
  • Sports
  • Misc
  • Computer Games
Digital Living
  • Hardware
  • Automotive
  • New Net Users
  • New Users
  • Software
  • Digital Music
  • Gaming World
  • Home Security
  • Apple
  • Networking Hardware
Virus & Spyware
  • Vulnerabilities
  • IDS
  • Encryption
  • Anti-Virus
  • Operating Systems Security
  • Software Firewalls
  • WebApplications
  • Cell Phones
  • Operating Systems
  • Internet
  • Hardware Firewalls
Hardware
  • Displays / Monitors
  • Handhelds / PDAs
  • Components
  • Peripherals
  • Laptops/Notebooks
  • Servers
  • Misc
  • Apple
  • Embedded Hardware
  • Networking Hardware
  • Storage
  • Desktops
  • New Users
Software
  • System Utilities
  • Industry Specific
  • Network Management
  • Photos / Graphics
  • Page Layout
  • VMware
  • Misc
  • Web Development
  • OS
  • CYGWIN
  • Voice Recognition
  • Virtualization
  • Message Queue
  • Quality Assurance
  • Security
  • Firewalls
  • MultiMedia Applications
  • Development
  • Database
  • Office / Productivity
  • Business Management
  • OS/2 Apps
  • Server Software
  • Internet / Email
ITPro
  • OS
  • Storage
  • Encryption
  • Operating Systems Security
  • Apple Hardware
  • Laptops & Notebooks
  • Servers
  • Networking Hardware
  • Peripherals
  • Devices
  • Displays / Monitors
  • WebTrends / Stats
  • Search Engines
  • Firewalls
  • Web Computing
  • WebApplications
  • IDS
  • Vulnerabilities
  • Email Clients
  • File Sharing
  • Spy / Ad Blockers
  • Web Browsers
  • Web Servers
  • Networking
  • Anti-Virus
  • Consulting
  • Chat / IM
  • Anti Spam
Developer
  • Web Servers
  • Web Browsers
  • Game Programming
  • Dev Tools
  • Industry Specific
  • Office / Productivity
  • Database
  • CYGWIN
  • Web Development
  • Search Engines
  • File Sharing
  • WebTrends / Stats
  • Programming
  • Content Management
  • Application Servers
  • Protocols
Storage
  • Removable Backup Media
  • Storage Technology
  • Servers
  • Grid
  • Remote Access
  • Backup / Restore
  • Misc
  • Hard Drives
OS
  • Miscellaneous
  • Security
  • Development
  • Linux
  • VMware
  • MainFrame OS
  • Unix
  • Apple
  • OS / 2
  • AS / 400
  • BeOS
  • Microsoft
  • VMS / OpenVMS
Database
  • Oracle
  • Miscellaneous
  • MySQL
  • Software
  • Sybase
  • Contact Management
  • PostgreSQL
  • Data Manipulation
  • Clarion
  • InterSystems Cache
  • Siebel
  • MUMPS
  • OLAP
  • SQLBase
  • SAS
  • GIS & GPS
  • 4GL
  • Berkeley DB
  • DB2
  • Informix
  • Interbase / Firebird
  • FoxPro
  • Reporting
  • LDAP
  • Filemaker Pro
  • MS SQL Server
  • dBase
  • MS Access
Security
  • Misc
  • Web Browsers
  • Software Firewalls
  • Operating Systems Security
  • File Sharing
  • Spy / Ad Blockers
  • Vulnerabilities
  • WebApplications
  • IDS
  • Anti-Virus
  • Encryption
  • Anti Spam
  • Email Clients
  • VPN
  • Chat / IM
Programming
  • Editors IDEs
  • Installation
  • Handhelds / PDAs
  • Multimedia Programming
  • System / Kernel
  • Automation
  • Algorithms
  • Game
  • Signal Processing
  • Project Management
  • Open Source
  • Database
  • Misc
  • Languages
  • Processor Platforms
  • Theory
Web Development
  • Scripting
  • Blogs
  • Web Servers
  • Software
  • Search Engines
  • Web Graphics
  • Web Services
  • Images
  • Internet Marketing
  • Images and Photos
  • Components
  • Document Imaging
  • Web Languages/Standards
  • Illustration
  • WebApplications
  • Fonts
  • WebTrends / Stats
  • Authoring
  • Digital Camera Software
  • Miscellaneous
Networking
  • Protocols
  • Apple Networking
  • Network Management
  • Message Queue
  • Application Servers
  • Content Management
  • File Servers
  • Email Servers
  • Misc
  • Java Editors & IDEs
  • Wireless
  • Networking Hardware
  • Backup / Restore
  • System Utilities
  • ISPs & Hosting
  • Web Servers
  • Storage Technology
  • Removable Backup Media
  • Servers
  • Web Computing
  • Broadband
  • Grid
  • OS / 2
  • Novell Netware
  • Unix Networking
  • Windows Networking
  • Security
  • Telecommunications
  • Operating Systems
  • Linux Networking
Other
  • Lounge
  • Business Travel
  • Community Support
  • New Net Users
  • Philosophy / Religion
  • Math / Science
  • Miscellaneous
  • URLs
  • Expert Lounge
  • Politics
  • Puzzles / Riddles
  • Automotive
Community Support
  • Suggestions
  • New to EE
  • New Topics
  • CleanUp
  • Announcements
  • General
  • Feedback
  • Input
  • EE Bugs
 
02.28.2008 at 10:20PM PST, ID: 21011308

Rank: Guru

Are you sure that you return the same field-types from both datasources ?

http://msdn2.microsoft.com/en-us/library/bb738634.aspx
 
02.29.2008 at 07:50AM PST, ID: 21014293
Well, that's a good question...  

The only reason why I could see this throwing an error is because I am pulling data from the actual database ClientDB.Clients in one LINQ and current data that is new to the datasource ClientBindingSource on the second LINQ...

My guess here is that it doesn't know how to handle two separate updates.  IE  If I was to do an update on the ClientBindingSource and then another update on the ClientDB.Clients data.

Ideally I just need to keep track of the GUID-Name relation and I'm not actually making any changes on this data via the totalmembernames/MyClientsInFamilyBindingSource.

--John
 
03.07.2008 at 02:04PM PST, ID: 21074500
Not strictly an objection, but I just thought I'd point out that based on the error, the two queries are actually returning two different types. It's hard to say for sure from the information provided here, but it looks like the FamilyGUID from one of the two (can't tell which from the error) is actually a Nullable(Of Guid), and the other is a Guid. If you change whichever one is the Nullable(Of Guid) to use client.FamilyGUID.Value instead of just client.FamilyGUID, that might do the trick.
 
03.07.2008 at 02:25PM PST, ID: 21074658
I had the same problem with something else that I was doing and ended up solving it with the method below.  For the problem above, I originally used the method below but ended up doing away with that because of other issues that came up.  The new solution was to commit the changes to the database and then keeping track of the GUID so that if the user cancelled the input of this person I would simply delete them from the database.

Nevertheless, the method below is lengthy and I never did figure out how to resolve the original issue posted here or how to simplify the coding below (another question that never received any posts).

If you think that I should award points I don't have any problems with doing so,
John
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
Try
            Dim MyRotoDB As New RotoSchedDataContext
            Dim MyCurrentRoto = From rotoload In MyRotoDB.RotoLoads Select rotoload
            RotoSched_BindingSource.DataSource = MyCurrentRoto
 
            Dim MySnapData = From rotoload In MyRotoDB.RotoLoad_Snapshots Select rotoload
            RotoSched_Snapshot_BindingSource.DataSource = MySnapData
            RotoSched_Snapshot_BindingSource.Clear()
 
            For i As Integer = 0 To RotoSched_BindingSource.Count - 1
                Dim MyOlddata As RotoLoad = Nothing
                Dim MyNewData As RotoLoad_Snapshot = RotoSched_Snapshot_BindingSource.AddNew
 
                MyOlddata = RotoSched_BindingSource.Item(i)
                'Assign data
                MyNewData.DeMoldCode = MyOlddata.DeMoldCode
                MyNewData.HeatCode = MyOlddata.HeatCode
                MyNewData.MachinePref = MyOlddata.MachinePref
                MyNewData.MarkedForRemove = MyOlddata.MarkedForRemove
                MyNewData.PartNumber = MyOlddata.PartNumber
                'Add to new table
                RotoSched_Snapshot_BindingSource.Add(MyNewData)
            Next
            RotoSched_BindingSource.EndEdit()
            RotoSched_Snapshot_BindingSource.EndEdit()
            MyRotoDB.SubmitChanges()
            MsgBox("Restore point created", MsgBoxStyle.Information)
        Catch ex As Exception
            MsgBox(ex.ToString, MsgBoxStyle.Critical)
        End Try
Open in New Window
Accepted Solution
 
03.07.2008 at 06:58PM PST, ID: 21075662
A request has been made in Community Support to close this question:
http://www.experts-exchange.com/Q_23224242.html

If there are no objections, a moderator will finalize this question in approximately 4 days as follows:
PAQ with refund using {http:#a21074658}

Please leave any recommendations here.

modus_operandi
EE Moderator
 
 
03.12.2008 at 05:47PM PDT, ID: 21112293
Closed, 500 points refunded.
modus_operandi
EE Moderator
 
 
 
20080236-EE-VQP-29 / EE_QW_2_20070628