473,671 Members | 2,305 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataView Inner Join

I have an orders table. Each record in the orders table contains a customer id.

I have a customer table. The primary key of each record in the customer
table is the customer id.

After getting a subset from the orders table, I need to take the customer
ids in the orders table subset, and list each record in the customer table
that has a matching customer id.

If I were in t-sql, this would be an easy inner join. In this case, I get
both complete tables in memory, and can only show the subset tables as
DataViews (or something like a DataView). I can't toss the original tables as
the user can request different views.

Any thoughts on creating a DataView in an inner join sort of way?

Thanks,
--
Randy
Jun 20 '06 #1
7 10206
Hi,

Unfortunatelly you cannot do it, You have several options though.

You can create a DataView and using the RowFilter property , you can use
"in" : new DataView(....., "clientID in ( 1,2,3,4 ) );


--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"randy1200" <ra*******@news groups.nospam> wrote in message
news:78******** *************** ***********@mic rosoft.com...
I have an orders table. Each record in the orders table contains a customer
id.

I have a customer table. The primary key of each record in the customer
table is the customer id.

After getting a subset from the orders table, I need to take the customer
ids in the orders table subset, and list each record in the customer table
that has a matching customer id.

If I were in t-sql, this would be an easy inner join. In this case, I get
both complete tables in memory, and can only show the subset tables as
DataViews (or something like a DataView). I can't toss the original tables
as
the user can request different views.

Any thoughts on creating a DataView in an inner join sort of way?

Thanks,
--
Randy

Jun 20 '06 #2
I would suggest you to use parameterized stored procedure to retrieve the
rows to the Dataview.

chanmm

"randy1200" <ra*******@news groups.nospam> wrote in message
news:78******** *************** ***********@mic rosoft.com...
I have an orders table. Each record in the orders table contains a customer
id.

I have a customer table. The primary key of each record in the customer
table is the customer id.

After getting a subset from the orders table, I need to take the customer
ids in the orders table subset, and list each record in the customer table
that has a matching customer id.

If I were in t-sql, this would be an easy inner join. In this case, I get
both complete tables in memory, and can only show the subset tables as
DataViews (or something like a DataView). I can't toss the original tables
as
the user can request different views.

Any thoughts on creating a DataView in an inner join sort of way?

Thanks,
--
Randy

Jun 20 '06 #3
Thanks. Response times seem okay up to 1000 records in each table. At 10,000
records, response times take about one minute. The time get consumed by
looping through the DataRows from the second table to be put in the "in"
clause for the first table. Pointers to any other options would be
appreciated.

DataRow[] drs = dt2.Select("fk> 2000");

string rowFilter = "id1 in (";

foreach (DataRow dr in drs)
{
rowFilter += dr["fk"].ToString() + ",";
}
//Note, the extra comma at the end doesn't matter
rowFilter += ")";

Console.WriteLi ne(rowFilter);

//dv2 = new DataView(dt1, "id1 in (10, 20,)", "id1",
DataViewRowStat e.CurrentRows);
dv1 = new DataView(dt1, rowFilter, "id1",
DataViewRowStat e.CurrentRows);
dataGridView1.D ataSource = dv1;
--
Randy
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

Unfortunatelly you cannot do it, You have several options though.

You can create a DataView and using the RowFilter property , you can use
"in" : new DataView(....., "clientID in ( 1,2,3,4 ) );


--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"randy1200" <ra*******@news groups.nospam> wrote in message
news:78******** *************** ***********@mic rosoft.com...
I have an orders table. Each record in the orders table contains a customer
id.

I have a customer table. The primary key of each record in the customer
table is the customer id.

After getting a subset from the orders table, I need to take the customer
ids in the orders table subset, and list each record in the customer table
that has a matching customer id.

If I were in t-sql, this would be an easy inner join. In this case, I get
both complete tables in memory, and can only show the subset tables as
DataViews (or something like a DataView). I can't toss the original tables
as
the user can request different views.

Any thoughts on creating a DataView in an inner join sort of way?

Thanks,
--
Randy


Jun 20 '06 #4
Hi,

use StringBuilder instead of String for the concatenation.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"randy1200" <ra*******@news groups.nospam> wrote in message
news:A5******** *************** ***********@mic rosoft.com...
Thanks. Response times seem okay up to 1000 records in each table. At
10,000
records, response times take about one minute. The time get consumed by
looping through the DataRows from the second table to be put in the "in"
clause for the first table. Pointers to any other options would be
appreciated.

DataRow[] drs = dt2.Select("fk> 2000");

string rowFilter = "id1 in (";

foreach (DataRow dr in drs)
{
rowFilter += dr["fk"].ToString() + ",";
}
//Note, the extra comma at the end doesn't matter
rowFilter += ")";

Console.WriteLi ne(rowFilter);

//dv2 = new DataView(dt1, "id1 in (10, 20,)", "id1",
DataViewRowStat e.CurrentRows);
dv1 = new DataView(dt1, rowFilter, "id1",
DataViewRowStat e.CurrentRows);
dataGridView1.D ataSource = dv1;
--
Randy
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

Unfortunatelly you cannot do it, You have several options though.

You can create a DataView and using the RowFilter property , you can use
"in" : new DataView(....., "clientID in ( 1,2,3,4 ) );


--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"randy1200" <ra*******@news groups.nospam> wrote in message
news:78******** *************** ***********@mic rosoft.com...
>I have an orders table. Each record in the orders table contains a
>customer
>id.
>
> I have a customer table. The primary key of each record in the customer
> table is the customer id.
>
> After getting a subset from the orders table, I need to take the
> customer
> ids in the orders table subset, and list each record in the customer
> table
> that has a matching customer id.
>
> If I were in t-sql, this would be an easy inner join. In this case, I
> get
> both complete tables in memory, and can only show the subset tables as
> DataViews (or something like a DataView). I can't toss the original
> tables
> as
> the user can request different views.
>
> Any thoughts on creating a DataView in an inner join sort of way?
>
> Thanks,
> --
> Randy


Jun 20 '06 #5
Unfortunately, I don't control the web service that provides my data. A
request has been placed...
--
Randy
"chanmm" wrote:
I would suggest you to use parameterized stored procedure to retrieve the
rows to the Dataview.

chanmm

"randy1200" <ra*******@news groups.nospam> wrote in message
news:78******** *************** ***********@mic rosoft.com...
I have an orders table. Each record in the orders table contains a customer
id.

I have a customer table. The primary key of each record in the customer
table is the customer id.

After getting a subset from the orders table, I need to take the customer
ids in the orders table subset, and list each record in the customer table
that has a matching customer id.

If I were in t-sql, this would be an easy inner join. In this case, I get
both complete tables in memory, and can only show the subset tables as
DataViews (or something like a DataView). I can't toss the original tables
as
the user can request different views.

Any thoughts on creating a DataView in an inner join sort of way?

Thanks,
--
Randy


Jun 20 '06 #6
Thanks for the StringBuilder pointer. Any other pointers?
--
Randy
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

use StringBuilder instead of String for the concatenation.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"randy1200" <ra*******@news groups.nospam> wrote in message
news:A5******** *************** ***********@mic rosoft.com...
Thanks. Response times seem okay up to 1000 records in each table. At
10,000
records, response times take about one minute. The time get consumed by
looping through the DataRows from the second table to be put in the "in"
clause for the first table. Pointers to any other options would be
appreciated.

DataRow[] drs = dt2.Select("fk> 2000");

string rowFilter = "id1 in (";

foreach (DataRow dr in drs)
{
rowFilter += dr["fk"].ToString() + ",";
}
//Note, the extra comma at the end doesn't matter
rowFilter += ")";

Console.WriteLi ne(rowFilter);

//dv2 = new DataView(dt1, "id1 in (10, 20,)", "id1",
DataViewRowStat e.CurrentRows);
dv1 = new DataView(dt1, rowFilter, "id1",
DataViewRowStat e.CurrentRows);
dataGridView1.D ataSource = dv1;
--
Randy
"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

Unfortunatelly you cannot do it, You have several options though.

You can create a DataView and using the RowFilter property , you can use
"in" : new DataView(....., "clientID in ( 1,2,3,4 ) );


--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"randy1200" <ra*******@news groups.nospam> wrote in message
news:78******** *************** ***********@mic rosoft.com...
>I have an orders table. Each record in the orders table contains a
>customer
>id.
>
> I have a customer table. The primary key of each record in the customer
> table is the customer id.
>
> After getting a subset from the orders table, I need to take the
> customer
> ids in the orders table subset, and list each record in the customer
> table
> that has a matching customer id.
>
> If I were in t-sql, this would be an easy inner join. In this case, I
> get
> both complete tables in memory, and can only show the subset tables as
> DataViews (or something like a DataView). I can't toss the original
> tables
> as
> the user can request different views.
>
> Any thoughts on creating a DataView in an inner join sort of way?
>
> Thanks,
> --
> Randy


Jun 20 '06 #7
Hi Randy,

It seems that you need to get the Customer information from the parent
table when you have an order in the child table. In this case, I suggest
you try to add some expression columns to the child table(Orders) which map
to the parent table columns. Then you will see all the values in the child
table.

First you will need to create DataRelation between the two tables in the
DataSet schema. Then in the DataColumn.Expr ession property, you can specify
as "Parent.(Relati onName).Custome rName", to make the column display the
Customer's name.

Please check the following link for more information about the Expression
property.

http://msdn.microsoft.com/library/de...us/cpref/html/
frlrfsystemdata datacolumnclass expressiontopic .asp

Kevin Yu
Microsoft Online Community Support

=============== =============== =============== =============== =============== =
=============== ===========
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=============== =============== =============== =============== =============== =
=============== ===========

(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Jun 21 '06 #8

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

Similar topics

3
3347
by: Ike | last post by:
Oh I have a nasty query which runs incredibly slowly. I am running MySQL 4.0.20-standard. Thus, in trying to expedite the query, I am trying to set indexes in my tables. My query requires four inner joins, as follows : SELECT DISTINCT upcards.id,statuskey.status,upcards.firstname,upcards.lastname,originkey.ori gin,associatekey.username,associatekey2.username,upcards.deleted FROM upcards,status,origins,associates INNER JOIN status...
3
6411
by: Prem | last post by:
Hi, I am having many problems with inner join. my first problem is : 1) I want to know the precedance while evaluating query with multiple joins. eg. select Employees.FirstName, Employees.LastName, TerritoryID, Employees.EmployeeID, RegionID, ProductID from Employees
9
5886
by: Marty McFly | last post by:
Greetings, I'm trying to let my users dynamically filter records from a table that relate to other tables. RELATIONSHIPS: . = . . = . There is a Many-to-Many relationship between CustomersTable and
6
9305
by: dmonroe | last post by:
hi group -- Im having a nested inner join problem with an Access SQl statement/Query design. Im running the query from ASP and not usng the access interface at all. Here's the tables: tblEmployees empId -- EmpName -- EmpRole -- EmpManager -------....------------.... ---------....--------------- 1........ dan yella..........1..........2
52
6314
by: MP | last post by:
Hi trying to begin to learn database using vb6, ado/adox, mdb format, sql (not using access...just mdb format via ado) i need to group the values of multiple fields - get their possible variations(combination of fields), - then act on each group in some way ...eg ProcessRs (oRs as RecordSet)... the following query will get me the distinct groups
3
16502
by: Zeff | last post by:
Hi all, I have a relational database, where all info is kept in separate tables and just the id's from those tables are stored in one central table (tblMaster)... I want to perform a query, so all data from the separate tables is shown in a view (instead of the reference id's pointing to the separate tables...) I have some troubles formulating the SQL statement: I tried:
12
13181
by: Chamnap | last post by:
Hello, everyone I have one question about the standard join and inner join, which one is faster and more reliable? Can you recommend me to use? Please, explain me... Thanks Chamnap
1
4600
by: teneesh | last post by:
Here I have a code for a view that has been created by a developer on my team. I am trying to use the very same code to create a view for a different formid/quesid. But I cannot figure out how this one starts and ends. can someone please help. here's the code from the developer. SELECT a.EvalRecNo, w1.q1, w2.q2, w3.q3, w4.q4, w5.q5, w6.comment FROM (SELECT DISTINCT u.EvalRecNo FROM dbo.UData AS u...
2
4456
by: MATTXtwo | last post by:
I have this store procedure to select data from table with join like this...SELECT tblPeribadi.Personel_No, tblPeribadi.Nama,tblCompany.Keterangan as Company_Code, tblPeribadi.Jawatan, tblPeribadi.Taraf_Jawatan, tblGroup.Keterangan AS Kumpulan,tblPeribadi.Gred,tblBusiness_Area.Keterangan AS Business_Area,tblCost_Center.Keterangan AS Kod_Pusat_Kos, tblPeribadi.IC_Baru, tblPeribadi.IC_Lama, ...
0
8473
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8390
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8819
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8667
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7428
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4402
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2048
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1806
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 can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.