473,513 Members | 2,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Error when using LINQ to dataset

112 New Member
Hi,

I am using LINQ to join two different datatables. I am trying to put the result in a dataset.

This code was working fine till yesterday. But today when I run the code, it gives me the error,

Unable to cast object of type '<JoinIterator>d__61`4[System.Data.DataRow,System.Data.DataRow,System.Dec imal,VB$AnonymousType_0`10[System.Decimal,System.DateTime,System.DateTime,Sys tem.DateTime,System.DateTime,System.Decimal,System .Decimal,System.String,System.String,System.String]]' to type 'System.Data.DataSet'."

I am not sure why it is not working. My code is as below. Please guide me. thank you

Expand|Select|Wrap|Line Numbers
  1.   Dim dt2 As New DataTable
  2.             dt2.Load(dr2)
  3.             Dim dt3 As New DataTable
  4.             dt3.Load(dr3)
  5.           Dim ds As New DataSet
  6.  
  7.  
  8.  
  9.          Dim joinquery = From t1 In dt2.AsEnumerable() Join t2 In dt3.AsEnumerable() _
  10.                     On t1.Field(Of Decimal)("CLASS_NUMBER") Equals t2.Field(Of Decimal)("CLASS_NUMBER") _
  11.                     Select New With _
  12.                       {Key .CLASS_NUMBER = t1.Field(Of Decimal)("CLASS_NUMBER"), _
  13.                        Key .FACULTY_START_DT = t2.Field(Of DateTime)("FACULTY_START_DT"), _
  14.                        Key .FACULTY_END_DT = t2.Field(Of DateTime)("FACULTY_END_DT"), _
  15.                        }
  16.  
  17.      ds = joinquery
  18.  
  19.  
  20.             NewDg.DataSource = ds
  21.             NewDg.DataBind()
Jul 5 '11 #1
0 1149

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1988
by: toufik toufik | last post by:
I've the folowing error "Call to undefined function: phtmldec() " when using a script encrypted with PHTML Here are the steps done: - I've Appache (windows XP), PHP434 - using PHTML, I've...
5
2618
by: Andrew James | last post by:
Gentlemen, I'm running into a problem whilst testing the parsing of a language I've created with TPG . It seems that for some reason, TPG balks when I try to parse an expression whose first...
1
2473
by: H.L Bai | last post by:
hi, everybody i meet a parse error when i used the xml4c. any proposal is helpful. The error is following .../XMLRegionHandler.h:59 parse error before '*' .../XMLRegionHandler.h:60 parse...
1
426
by: Dermot O'Loughlin | last post by:
Can anyone help me with this? I get the following error when using the odbc adapter wizard in VS.Net 2003: --------------------------- Wizard Form --------------------------- An unexpected...
0
1275
by: Juan | last post by:
When populating a dataset I get an error if the data being retrieved includes a string field with a Null value: "Not valid store type: DBNull". What kinf of data type can i define in the dataset to...
0
1530
by: Charlie | last post by:
Hi: I get a TreeNode binding error when using Data property of XmlDataSource control. When I switch to TextFile property and point to xml file on hard drive, problem goes anyway. I'm...
0
1438
by: =?Utf-8?B?TG93bGFuZGVy?= | last post by:
Hello, I've built a web application that uses client script callbacks. It is used on a large network with a large variety of user OSes and IE versions. It was tested on IE 6 on different setups...
8
4004
by: msnews.microsoft.com | last post by:
Our IT team relocated our application servers yesterday. They had to take one machine out of the cluster because it would prompt users for credentials if accessed using the IP address, which I...
7
2845
by: svsenthilkumar | last post by:
Hai, I got an javascript error when using ajax in mozilla browser, anyone help me why the error is coming, meaning for this error and how can i rectify this error. Error: " nsresult:...
2
10177
by: Big Daddy | last post by:
For example, if I have a DB table called DownloadPoints with a column named DownloadPointNo, then SqlMetal will create a file with a class called DownloadPoints with an accessor named...
0
7260
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
7537
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
7525
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5685
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3233
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
3222
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1594
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
799
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
456
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.