473,386 Members | 1,973 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,386 software developers and data experts.

Binding Datagrids

Can you bind a datarelation to a datagrid? I posted my
code below. I built a datarelation with "Users" as
parent and "Computer" as child to create a table
called "Info" in dataset "ds".

I bind my datagrid to the datarelation table "Info" but
the datagrid shows up empty. I debugged the "Info" table
and it shows no records.

The purpose of this is that I need the child table to
display actual text data in the data grid instead of a
number. I can't do a normal query because the two tables
I need are in two different databases.

Thanks for any help!

'Build datareation
Dim drn As DataRelation
Dim dcParent As DataColumn
Dim dcChild As DataColumn

dcParent = ds.Tables("Users").Columns("UserID")
dcChild = ds.Tables("Computer").Columns("c_users")

drn = New DataRelation("Info", dcParent, dcChild)
ds.Relations.Add(drn)

DataGrid1.DataSource = ds.Tables("Info")
DataGrid1.DataBind()

Nov 18 '05 #1
0 817

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Ben Reese | last post by:
I think that my problem is similar to the one entitled "Subject: Complicated Data Binding Question" of 7/2/2005 Simply: I have a pair of combo (dropdown List) boxes that I want to display data...
0
by: Carlos | last post by:
I’m constructing a Windows Forms application that accesses SQLServer data via a dataset. The dataset contains 2 tables “tblMaster” and “tblDetail” which are related in a one-to-many relationship...
2
by: John Smith | last post by:
Hey folks, I'm writing a Windows application which has many forms which have Datagrids on them to display data. These datagrids will not be editable in anyway. They are there to just view the...
6
by: GingerNinja | last post by:
Hi Everybody, its about my 4th day on C# and all seems to be going smoothly however I've started to get into Datagrids and in particular binding data sources to them. In the documentation it says I...
3
by: Lloyd Sheen | last post by:
I am having trouble with an app that does the following: 1. Query SQL Server and return one row 2. Bind the columns to text boxes 3. User updates info 4. User clicks update button ...
3
by: Jim Bancroft | last post by:
Hi everyone, I'm binding an ArrayList to a DataGrid for the first time (I'm used to binding DataSets and DataTables) and I was wondering if I could somehow "name" the ArrayList, so that I can...
7
by: erniej | last post by:
as per instructions in the walkthrough, I have managed to create a master/detail relationship between two datagrids. However I have a requirement to apply this to three datagrids and the third...
8
by: Richard L Rosenheim | last post by:
I have a dataset containing a parent table related to a child table. The child table contains an ID field (which is configured as autonumber in the datatable), the ID of the parent, plus some...
2
by: yuanh23 | last post by:
Hi, I have 3 talbes "customers","orders","details". i wanna to use 3 datagrids to show those tables. and when the selected row in parent talbe changes, the selected row in child table changes...
1
by: bilalso | last post by:
Hi, I have a datatable that has different columns such as ItemID OrderID OrderSize OrderPrice Only at the startup I load these values from the database and afterwards I add new rows in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
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...

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.