473,414 Members | 1,627 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

Question about Datarelation and dataset

112 100+
hi,

I am using datarelation to join two datatables.
Here is my code,
Expand|Select|Wrap|Line Numbers
  1.  Dim dt1 As New DataTable
  2.             dt1.Load(dr1)
  3.             Dim dt2 As New DataTable
  4.             dt2.Load(dr2)
  5.  
  6.             Dim datarelation As DataRelation
  7.             Dim dc1 As DataColumn
  8.             Dim dc2 As DataColumn
  9.             Dim ds As New DataSet
  10.  
  11.             ds.Tables.Add(dt1)
  12.             ds.Tables.Add(dt2)
  13.             dc1 = dt1.Columns("CL_R")
  14.             dc2 = dt2.Columns("CL_R")
  15.  
  16.             datarelation = New DataRelation("JoinData", dc1, dc2)
  17.             ds.Relations.Add(datarelation)
  18.  
  19.             NewDg.DataSource = ds
  20.             NewDg.DataBind()
  21.  
I would like to display both the tables, dt1 and dt2 in the datagrid, NewDg.
Now it displays only the data of datatable dt1.
I want to display both the tables.I tried to use DataView, but could not get any output.
Expand|Select|Wrap|Line Numbers
  1. Dim dv As New DataView(ds.Tables("dt2"))
  2.             NewDg.DataSource = dv
could someone please guide me. thank you
Jun 30 '11 #1
0 1106

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

Similar topics

4
by: Andrew Carlson | last post by:
I have a class that performs a few methods on a dataset. That dataset then fills a grid on a form. What I would like to do is to assign a particular dataset to the class at runtime. For...
2
by: Tom | last post by:
In RecordSet, there is EOF. But, there is no EOF in DataSet. There is only EOF in XMLReader. I use sqlDataAdapter and DataSet to retreive data from DB. I need to know whether it is the end of the...
1
by: Raymond Du | last post by:
Hi, I am using Dataset's ReadXML method to read an XML file. Here i s my code snippet: Dim dsTemp As New DataSet dsTemp.ReadXml(Server.MapPath("~/data3.xml")) and data3.xml as follow:...
2
by: Rudy | last post by:
Hello all! So I get the following error when I try to update my dataset from a windows form. "Can't create a child list for field 'TableName'" This is the error I get in my application, I found...
2
by: Kai Zhang | last post by:
I am new to DB programing, and I got a problem using dataset and datagrid. I have 3 tables: Position: PositionID (PK) JobTitleID (FK) DepartmentID (FK) JobTitle: JobTitleID (PK)
3
by: joeycalisay | last post by:
Can one transfer an UnCommitted Dataset (AcceptChanges hasn't been called) through WebServices? If yes, are the RowVersions also transmitted? Thanks a lot! -- Joey Calisay...
4
by: Newbie | last post by:
Could someone answer a vb.net database question? what is a good way to code a form so that a user could navigate through a dataset ie: MoveFirst, MoveNext, MovePrevious, MoveLast, Update and...
3
by: shachar | last post by:
hi all. in my dev team we have an argument about retrieving Records from DB to DataSet. the big question is: should i retrieve all the records from my table (max 4000 records) to my DataSet, and...
1
by: Tony Johansson | last post by:
Hello! A DataSet is using XML to represent data that is stored locally. I just wonder how can I look at these XML data that describe the DataSet? //Tony
4
by: Manikrag | last post by:
Hi I did not find any solution on internet so pretty basic question here: I am trying to copy a dataset to a new dataset by ds1 = ds.Copy(); // ds has one row After that I am trying to...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.