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

how to position records in detail table???

here is the following situation :

I have a dataset with two tables

this.daCustomers.Fill(dsData1, "Customers");
this.daOrders.Fill(dsData1, "Orders");

as You see there are tables from Northwind :)
these tables have a relation
this.dsData1.Relations.Add("CustOrd",
dsData1.Tables[0].Columns["Customerid"],
dsData1.Tables[1].Columns["Customerid"]);
this.dsData1.Relations.Add("OrdDet",
dsData1.Tables[1].Columns["OrderId"], dsData1.Tables[2].Columns["OrderId"]);

and currencymanager

crmCustomers =
(CurrencyManager)this.BindingContext[dsData1.Tables["Customers"]];

I bind these two tables to to datagrids
first one as master:

this.grdCustomers.DataSource = dsData1.Tables[0];

sencond one as detial:

this.grdOrders.DataSource = dsData1.Tables[0];
this.grdOrders.DataMember= "CustOrd";

finally I add a label with current position of active record in the
master table.

this.lblCustomers.Text=(crmCustomers.Position+1).T oString() + "/" +
crmCustomers.Count.ToString();

until now everything is clear and it works. Now please tell me how to
create similiar label which allows me to show position of active record
in the detail table ???? It must be very easy but I have been thinking
on it second day and I still have no ideas :( All tutorials and
examples show how to use currency manager to master table but I didn't
find any peace of code with currency manager in detail table

The next question is how to sort, filter and search this detial table
but this question I'm going to ask when I solve problem with positioning

thanks in advance for any help
K.


Nov 16 '05 #1
1 1627
Hi,

Won't something like the following work:

crmOrders =
(CurrencyManager)this.BindingContext[grdOrders.DataSource,
grdOrders.DataMember];

this.lblOrders.Text=(crmOrders.Position+1).ToStrin g() + "/" +
crmOrders.Count.ToString();

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

"krzys" <kr*********@XXgazeta.pl> wrote in message
news:cs**********@inews.gazeta.pl...
here is the following situation :

I have a dataset with two tables

this.daCustomers.Fill(dsData1, "Customers");
this.daOrders.Fill(dsData1, "Orders");

as You see there are tables from Northwind :)
these tables have a relation
this.dsData1.Relations.Add("CustOrd",
dsData1.Tables[0].Columns["Customerid"],
dsData1.Tables[1].Columns["Customerid"]);
this.dsData1.Relations.Add("OrdDet", dsData1.Tables[1].Columns["OrderId"],
dsData1.Tables[2].Columns["OrderId"]);

and currencymanager

crmCustomers =
(CurrencyManager)this.BindingContext[dsData1.Tables["Customers"]];

I bind these two tables to to datagrids
first one as master:

this.grdCustomers.DataSource = dsData1.Tables[0];

sencond one as detial:

this.grdOrders.DataSource = dsData1.Tables[0];
this.grdOrders.DataMember= "CustOrd";

finally I add a label with current position of active record in the master
table.

this.lblCustomers.Text=(crmCustomers.Position+1).T oString() + "/" +
crmCustomers.Count.ToString();

until now everything is clear and it works. Now please tell me how to
create similiar label which allows me to show position of active record in
the detail table ???? It must be very easy but I have been thinking on it
second day and I still have no ideas :( All tutorials and examples show
how to use currency manager to master table but I didn't find any peace of
code with currency manager in detail table

The next question is how to sort, filter and search this detial table but
this question I'm going to ask when I solve problem with positioning

thanks in advance for any help
K.


Nov 16 '05 #2

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

Similar topics

1
by: Dave | last post by:
I am building an invoicing database. I have no problems searching for due dates and generating the invoice header. The problem is generating the invoice detail. My customers may have more than...
11
by: Jeremy Pridmore | last post by:
Hi All, Here's a challenge. If there is a 'one word' answer to this, i.e. the name of a built in SQL Server function I can use, that would be great! However... I have a standard 1:m...
1
by: Rowan | last post by:
Hi there, it has been a while since i have posted. I am in a situation where I am stumped. I am learning to build a dts package where I am connecting to a table in an AS400. This database is...
3
by: mark | last post by:
How do I get all fields on one page of a report? I have a report that has a column for each day of the week and 6 records for each day. I need each weekday's records returned on only one detail...
3
by: William Wisnieski | last post by:
Hello Everyone, I'm helping out a non-profit school with their database. They would like to know the last gift made by each donor, the donor name, and the gift amount. I built a query based...
1
by: Rick A | last post by:
The database I'm developing for a local charity has a table with detail records of individual transactions with our donors. This table has an integer "donorID" column that is a foreign key to a...
7
by: Ron | last post by:
Hi All, Using Access2000, winXP. Table 1 = tblClients displayed on frmClients via qryClients. 2nd table = tblInvoices shown on frmInvoices via qryInvoices. 2nd table = tblDetails shown on...
2
by: rdraider | last post by:
Using SQL 2000, how can you combine multiple records into 1? The source data is varchar(255), the destination will be text. I need help with the select statement. example tables: CREATE TABLE ...
1
by: Miley | last post by:
Hi everyone, This is my question/problem. I have a table with orders and a table with order details. Clients can order multiple products at once during one order, so one line has to be inserted...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
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...

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.