|
 |
ado_dotnet thread: Finding Row help
Message #1 by "Thomas Nowak" <ten1209@a...> on Fri, 14 Feb 2003 13:52:00
|
|
I have an application that uses a OleDbDataAdapter. I
have a dataset that contains 8 fields (8 name fields), and
another dataset that contains 2 fields (name and status).
I want my program to read each row of the 8 field dataset,
and perform a calculation based on the status information
found in the other dataset.
Example:
Dataset1
F1 F2 F3 F4 F5 F6 F7 F8
Tom Joe Sam Bill Fred Mark Dan Doug
Dataset2
Name Status
Tom 2
Joe 3
Bill 0
etc
Whats the easiest way to do this? Please help.
Message #2 by "h@f... on Fri, 14 Feb 2003 10:20:24 -0800 (PST)
|
|
Make two data adapters using wizard.
now go into the code window. and type the following:
dim ds1 as dataset = new dataset()
dim ds2 as dataset = new dataset()
dim table1 as datatable ' for first table
dim row1 as datarow ' for second table
dim index as integer
try
ad1.fill(ds1) ' fill first data adapter
ad2.fill(ds2)' fill second data adapter
table1 = ds1.tables.item(0)
for index=0 to table1.rows.count -1
row1 = table1.rows.item(index)
//now perform calculations like this row(0) = "hafiz" and row(1) = "qasim"
next
ad1.update(ds1) ' only if u change some code
//suggestion
// repeat this code for the second table and make changes and then update the tab le2 like i did above for table1
Thomas Nowak <ten1209@a...> wrote: I have an application that uses a OleDbDataAdapter. I
have a dataset that contains 8 fields (8 name fields), and
another dataset that contains 2 fields (name and status).
I want my program to read each row of the 8 field dataset,
and perform a calculation based on the status information
found in the other dataset.
Example:
Dataset1
F1 F2 F3 F4 F5 F6 F7 F8
Tom Joe Sam Bill Fred Mark Dan Doug
Dataset2
Name Status
Tom 2
Joe 3
Bill 0
etc
Whats the easiest way to do this? Please help.
===
Fast Track ADO.NET with C# is a concise introduction to the concepts, techniques, and libraries that you will need in order to start
using ADO.NET in your applications. The book covers DataSets and Typed DataSets, accessing data using DataReaders and DataAdaptors,
the close relationship between ADO.NET and XML, how and where to use ADO.NET in your enterprise applications, and how to use Web
Services and ADO.NET to easily pass data between applications.
http://www.wrox.com/books/1861007604.htm
---------------------------------
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
Message #3 by "Thomas Nowak" <ten1209@a...> on Fri, 14 Feb 2003 19:37:20
|
|
> I understand up to the //now perform calculations. Sounds like at this
point I want to do a compare of a column in the first dataset to a column
in the 2nd dataset, and do a calc if these fields are identical. how
would I code this?
Make two data adapters using wizard.
now go into the code window. and type the following:
dim ds1 as dataset = new dataset()
dim ds2 as dataset = new dataset()
dim table1 as datatable ' for first table
dim row1 as datarow ' for second table
dim index as integer
try
ad1.fill(ds1) ' fill first data adapter
ad2.fill(ds2)' fill second data adapter
table1 = ds1.tables.item(0)
for index=0 to table1.rows.count -1
row1 = table1.rows.item(index)
//now perform calculations like this row(0) = "hafiz" and row(1) = "qasim"
next
ad1.update(ds1) ' only if u change some code
//suggestion
// repeat this code for the second table and make changes and then update
the tab le2 like i did above for table1
Thomas Nowak <ten1209@a...> wrote: I have an application that
uses a OleDbDataAdapter. I
have a dataset that contains 8 fields (8 name fields), and
another dataset that contains 2 fields (name and status).
I want my program to read each row of the 8 field dataset,
and perform a calculation based on the status information
found in the other dataset.
Example:
Dataset1
F1 F2 F3 F4 F5 F6 F7 F8
Tom Joe Sam Bill Fred Mark Dan Doug
Dataset2
Name Status
Tom 2
Joe 3
Bill 0
etc
Whats the easiest way to do this? Please help.
===
Fast Track ADO.NET with C# is a concise introduction to the concepts,
techniques, and libraries that you will need in order to start using
ADO.NET in your applications. The book covers DataSets and Typed DataSets,
accessing data using DataReaders and DataAdaptors, the close relationship
between ADO.NET and XML, how and where to use ADO.NET in your enterprise
applications, and how to use Web Services and ADO.NET to easily pass data
between applications.
http://www.wrox.com/books/1861007604.htm
---------------------------------
Do you Yahoo!?
Yahoo! Shopping - Send Flowers for Valentine's Day
Message #4 by yaping_yangey <yaping_yangey@s...> on Sat, 15 Feb 2003 10:30:46 +0800
|
|
Thomas,
Maybe it's useful for you.
You can create a view for the two dataset.table, add the joined view into the 8 field dataset, Add related method for the view, and
now you can do the calculation in the same dataset.
good regards,
ChrisYang
----- Original Message -----
From:"Thomas Nowak" <ten1209@a...>
To:"ADO.NET" <ado_dotnet@p...>
Subject:[ado_dotnet] Finding Row help
Date:Fri, 14 Feb 2003 21:52:00 +0800
>I have an application that uses a OleDbDataAdapter. I
>have a dataset that contains 8 fields (8 name fields), and
>another dataset that contains 2 fields (name and status).
>I want my program to read each row of the 8 field dataset,
>and perform a calculation based on the status information
>found in the other dataset.
>
>Example:
>
>Dataset1
>
>F1 F2 F3 F4 F5 F6 F7 F8
>Tom Joe Sam Bill Fred Mark Dan Doug
>
>Dataset2
>
>Name Status
>Tom 2
>Joe 3
>Bill 0
>
>etc
>
>Whats the easiest way to do this? Please help.
>
>===
>Fast Track ADO.NET with C# is a concise introduction to the concepts, techniques, and libraries that you will need in order to
start using ADO.NET in your applications. The book covers DataSets and Typed DataSets, accessing data using DataReaders and
DataAdaptors, the close relationship between ADO.NET and XML, how and where to use ADO.NET in your enterprise applications, and how
to use Web Services and ADO.NET to easily pass data between applications.
>http://www.wrox.com/books/1861007604.htm
>
>
______________________________________
===================================================================
手机短信发送m到888810,免费获得新浪15M任你邮邮箱! (http://vip.sina.com/love_send/lover.html)
手机语音聊天国内长途5分钟/1元、帅哥美女靓照尽在爱情快递 (http://love.sina.com.cn)
发拜年短信 送万千祝福 赢双人港澳游大奖! (http://sms.sina.com.cn/act/spring2003.html)
|
|
 |