Questions tagged [datarelation]

60 questions
6
votes
3 answers

Does LINQ use DataRelations to optimize joins?

I can't find the answer to this anywhere, and before I start pawing through generated code with Reflector I thought it'd be worth asking: Suppose I have the following LINQ query run against DataTables in a DataSet: var list = from pr in…
Robert Rossney
  • 94,622
  • 24
  • 146
  • 218
5
votes
1 answer

DataRelation in a DataGridView

I have got a DataSet filled with two Tables: dbSet = new DataSet(); //DataTable and DataRelation DataTable dtStudent = new DataTable("Student"); //fill datatable 1 dtStudent.Columns.Add("Id", typeof(int)); dtStudent.Columns.Add("Name",…
brandart
  • 219
  • 1
  • 9
4
votes
2 answers

Inserting NULL into DataTable

Morning (in RSA at least), I'm trying to create a data driven menu, using data from a self-referencing table to create a (2-level) hierarchical structure. Example Data is: MenuID ParentID Text Url CSS 1 Null Top …
Paul Innes
  • 41
  • 1
  • 1
  • 2
4
votes
0 answers

Master / Detail datagridview with relation from type string in C#

I want to show a master / detail relationship using two datagridviews and DataRelation in C#. The relation between the master and the detail table is an ID from type string (and there is no chance to change the ID to type integer). It seems like the…
Daniel
4
votes
1 answer

How to model data entities with multiple parents?

How would I model a relationship between multiple entities where one entity could be part of two separate, unrelated, hierarchies and each entity could be related to 1 or more other entities in a non-hierarchical fashion? I would like to do this in…
Wayne E. Pfeffer
  • 245
  • 1
  • 7
  • 15
3
votes
2 answers

DataRelation Insert and ForeignKey

I have a winforms application with two DataGridViews displaying a master-detail relationship from my Person and Address tables. Person table has a PersonID field that is auto-incrementing primary key. Address has a PersonID field that is the FK. I…
Steve
  • 2,153
  • 4
  • 22
  • 31
3
votes
3 answers

How To: Use DataRelation to perform a join on two DataTables in a DataSet?

How do I perform a join between two DataTables in a Dataset? I created a DataRelation between two tables….then what? I'm looking at one explanation on how to do it (http://www.emmet-gray.com/Articles/DataTableJoins.htm) which involves copying rows…
dev.e.loper
  • 35,446
  • 76
  • 161
  • 247
2
votes
1 answer

Getting information about DataRelations in a DataSet

Using FillSchema-method of the data adapter I obtain the table structure using (SqlConnection sqlConn = new SqlConnection(connectionString)) { var dataAdapter = new SqlDataAdapter(); var dataSet = new DataSet(); …
alex555
  • 1,676
  • 4
  • 27
  • 45
2
votes
2 answers

DataSet select parent rows where child rows contains x value

I have two DataTables in a DataSet linked together by a DataRelation and I'm trying to select all parent rows that have a child row with value x. The parent table contains products and the child table contains categories that the product is…
Christian
  • 3,708
  • 3
  • 39
  • 60
2
votes
0 answers

Create Multiple DataRelations between three tables in DataSet (Not Strongly Typed)

I am familiar with programmatically loading a dataset with two tables and adding a parent child relationship between them. When I tried adding a third table and a second relationship in the same DataSet, I get unexpected results. I what I am…
Bengal
  • 329
  • 4
  • 21
2
votes
1 answer

Finding DataSet rows which violate a foreign relation?

If I do something like the following and then add a row that has a foreign key value that is not a primary key value in the parent table, no error is thrown. What I would like to do is the following: 1) Set up some foreign relations. 2) Merge some…
Fugu
  • 361
  • 2
  • 6
  • 17
2
votes
0 answers

A TableRow referenced trought a DataRelation always returns null

Using the DataSet designer in Visual Studio 2010, I've added some tables from a MySql DB. VS10 automatically picks up and adds the relations between the tables, e.g., the relation "FK_organisatie_adres" between the tables "Organisatie" and…
Robbie
  • 715
  • 3
  • 10
  • 18
2
votes
1 answer

Populating object properties from DataSet using LINQ

Here is my current relationship DataRelation relation = new DataRelation("EventCategoryRelation", eventsTable.Columns["event_id"],…
Aivan Monceller
  • 4,636
  • 10
  • 42
  • 69
2
votes
2 answers

.net dataset how to get deleted child rows

I have a strongly-typed dataset (VB.NET), using .NET Framework 2.0. Given a DataRow in a parent DataTable and a DataRelation, I need to find all related rows in the child DataTable that have a RowState = DataRowState.Deleted. Unfortunately for me,…
David Burson
  • 2,947
  • 7
  • 32
  • 55
2
votes
4 answers

What is the purpose of a DataRelation in a DataSet?

A C# program I am working on will need to export data to one or more tables of data. Some columns of these tables will be related to one another, such that the ID column of of one table may be reference by the cell of another table. This seems like…
Eric Anastas
  • 21,675
  • 38
  • 142
  • 236
1
2 3 4