473,550 Members | 2,641 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

New array of dataRow[]

Hi,
I have a loop an in the loop I populate an array of dataRow.
My problem is the array keeps its values from previous loop, and its Length
gets bigger every loop.
My code is:
DataRow[] foundRowsAct; sSQL ="SQL STATEMENT";
foundRowsAct = dtACTIVITIES.Se lect(sSQL);

I tried to write in the loop:
foundRowsAct=nu ll;

But it did not help.
What can I do to get a new array every loop?
Thanks in advance.

Jul 17 '06 #1
8 21849
Hi,

If you have a variant number of rows you better use ArrayList or
List<DataRowif possible.

what are you trying to do anyway?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Niron kag" <Ni******@discu ssions.microsof t.comwrote in message
news:0C******** *************** ***********@mic rosoft.com...
Hi,
I have a loop an in the loop I populate an array of dataRow.
My problem is the array keeps its values from previous loop, and its
Length
gets bigger every loop.
My code is:
DataRow[] foundRowsAct; sSQL ="SQL STATEMENT";
foundRowsAct = dtACTIVITIES.Se lect(sSQL);

I tried to write in the loop:
foundRowsAct=nu ll;

But it did not help.
What can I do to get a new array every loop?
Thanks in advance.

Jul 17 '06 #2
Ignacio Machin,
I do a query on dataTable and populate the dataRow[] with the results.
I do it in a “for”, In every loop the dataRow Length get bigger even when I
compare it to null before every loop.

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

If you have a variant number of rows you better use ArrayList or
List<DataRowif possible.

what are you trying to do anyway?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Niron kag" <Ni******@discu ssions.microsof t.comwrote in message
news:0C******** *************** ***********@mic rosoft.com...
Hi,
I have a loop an in the loop I populate an array of dataRow.
My problem is the array keeps its values from previous loop, and its
Length
gets bigger every loop.
My code is:
DataRow[] foundRowsAct; sSQL ="SQL STATEMENT";
foundRowsAct = dtACTIVITIES.Se lect(sSQL);

I tried to write in the loop:
foundRowsAct=nu ll;

But it did not help.
What can I do to get a new array every loop?
Thanks in advance.


Jul 17 '06 #3
Hi,

Why dont you use a DataView (as you are using a Datatable ) ?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Niron kag" <Ni******@discu ssions.microsof t.comwrote in message
news:33******** *************** ***********@mic rosoft.com...
Ignacio Machin,
I do a query on dataTable and populate the dataRow[] with the results.
I do it in a "for", In every loop the dataRow Length get bigger even when
I
compare it to null before every loop.

"Ignacio Machin ( .NET/ C# MVP )" wrote:
>Hi,

If you have a variant number of rows you better use ArrayList or
List<DataRow if possible.

what are you trying to do anyway?
--
--
Ignacio Machin,
ignacio.mach in AT dot.state.fl.us
Florida Department Of Transportation

"Niron kag" <Ni******@discu ssions.microsof t.comwrote in message
news:0C******* *************** ************@mi crosoft.com...
Hi,
I have a loop an in the loop I populate an array of dataRow.
My problem is the array keeps its values from previous loop, and its
Length
gets bigger every loop.
My code is:
DataRow[] foundRowsAct; sSQL ="SQL STATEMENT";
foundRowsAct = dtACTIVITIES.Se lect(sSQL);

I tried to write in the loop:
foundRowsAct=nu ll;

But it did not help.
What can I do to get a new array every loop?
Thanks in advance.



Jul 17 '06 #4
Do you think it is simple and better way?

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

Why dont you use a DataView (as you are using a Datatable ) ?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Niron kag" <Ni******@discu ssions.microsof t.comwrote in message
news:33******** *************** ***********@mic rosoft.com...
Ignacio Machin,
I do a query on dataTable and populate the dataRow[] with the results.
I do it in a "for", In every loop the dataRow Length get bigger even when
I
compare it to null before every loop.

"Ignacio Machin ( .NET/ C# MVP )" wrote:
Hi,

If you have a variant number of rows you better use ArrayList or
List<DataRowif possible.

what are you trying to do anyway?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Niron kag" <Ni******@discu ssions.microsof t.comwrote in message
news:0C******** *************** ***********@mic rosoft.com...
Hi,
I have a loop an in the loop I populate an array of dataRow.
My problem is the array keeps its values from previous loop, and its
Length
gets bigger every loop.
My code is:
DataRow[] foundRowsAct; sSQL ="SQL STATEMENT";
foundRowsAct = dtACTIVITIES.Se lect(sSQL);

I tried to write in the loop:
foundRowsAct=nu ll;

But it did not help.
What can I do to get a new array every loop?
Thanks in advance.



Jul 17 '06 #5
Yape, you should use dataset and datatable. One of the resources:
http://msdn2.microsoft.com/en-us/lib...et(d=ide).aspx

chanmm

"Niron kag" <Ni******@discu ssions.microsof t.comwrote in message
news:1E******** *************** ***********@mic rosoft.com...
Do you think it is simple and better way?

"Ignacio Machin ( .NET/ C# MVP )" wrote:
>Hi,

Why dont you use a DataView (as you are using a Datatable ) ?
--
--
Ignacio Machin,
ignacio.mach in AT dot.state.fl.us
Florida Department Of Transportation

"Niron kag" <Ni******@discu ssions.microsof t.comwrote in message
news:33******* *************** ************@mi crosoft.com...
Ignacio Machin,
I do a query on dataTable and populate the dataRow[] with the results.
I do it in a "for", In every loop the dataRow Length get bigger even
when
I
compare it to null before every loop.

"Ignacio Machin ( .NET/ C# MVP )" wrote:

Hi,

If you have a variant number of rows you better use ArrayList or
List<DataRow if possible.

what are you trying to do anyway?
--
--
Ignacio Machin,
ignacio.mach in AT dot.state.fl.us
Florida Department Of Transportation

"Niron kag" <Ni******@discu ssions.microsof t.comwrote in message
news:0C******* *************** ************@mi crosoft.com...
Hi,
I have a loop an in the loop I populate an array of dataRow.
My problem is the array keeps its values from previous loop, and its
Length
gets bigger every loop.
My code is:
DataRow[] foundRowsAct; sSQL ="SQL STATEMENT";
foundRowsAct = dtACTIVITIES.Se lect(sSQL);

I tried to write in the loop:
foundRowsAct=nu ll;

But it did not help.
What can I do to get a new array every loop?
Thanks in advance.




Jul 17 '06 #6
If "dtACTIVITI ES" is a DataTable, then you are fine doing things just the way
you are. Declare your "foundRowsA CT" array outside of (before) the loop and
set it to =null

if your loop is constructed correctly you will be re-assigning the DataRow[]
result of each sSQL query filter to the foundRowsACT DataRow array each time.
Its contents and the number or DataRows in it should be different for each
different sSQL query filter that you apply in your Select method.

If it isn't then you have some other kind of issue going on- e.g., maybe
your filter is no good.
Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Niron kag" wrote:
Hi,
I have a loop an in the loop I populate an array of dataRow.
My problem is the array keeps its values from previous loop, and its Length
gets bigger every loop.
My code is:
DataRow[] foundRowsAct; sSQL ="SQL STATEMENT";
foundRowsAct = dtACTIVITIES.Se lect(sSQL);

I tried to write in the loop:
foundRowsAct=nu ll;

But it did not help.
What can I do to get a new array every loop?
Thanks in advance.
Jul 17 '06 #7
Peter Bromberg,
The problem was that the dataTable that I used in the dataTable.selec t, was
filled in every loop by other data Adapter.
I solve the problem when in the beginning of each loop I wrote dtACTIVITIES
= new DataTable();
"Peter Bromberg [C# MVP]" wrote:
If "dtACTIVITI ES" is a DataTable, then you are fine doing things just the way
you are. Declare your "foundRowsA CT" array outside of (before) the loop and
set it to =null

if your loop is constructed correctly you will be re-assigning the DataRow[]
result of each sSQL query filter to the foundRowsACT DataRow array each time.
Its contents and the number or DataRows in it should be different for each
different sSQL query filter that you apply in your Select method.

If it isn't then you have some other kind of issue going on- e.g., maybe
your filter is no good.
Peter
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Niron kag" wrote:
Hi,
I have a loop an in the loop I populate an array of dataRow.
My problem is the array keeps its values from previous loop, and its Length
gets bigger every loop.
My code is:
DataRow[] foundRowsAct; sSQL ="SQL STATEMENT";
foundRowsAct = dtACTIVITIES.Se lect(sSQL);

I tried to write in the loop:
foundRowsAct=nu ll;

But it did not help.
What can I do to get a new array every loop?
Thanks in advance.
Jul 18 '06 #8
Hi,

Of course, it's the way to go, unless you really need a DataRow[]
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Niron kag" <Ni******@discu ssions.microsof t.comwrote in message
news:1E******** *************** ***********@mic rosoft.com...
Do you think it is simple and better way?

"Ignacio Machin ( .NET/ C# MVP )" wrote:
>Hi,

Why dont you use a DataView (as you are using a Datatable ) ?
--
--
Ignacio Machin,
ignacio.mach in AT dot.state.fl.us
Florida Department Of Transportation

"Niron kag" <Ni******@discu ssions.microsof t.comwrote in message
news:33******* *************** ************@mi crosoft.com...
Ignacio Machin,
I do a query on dataTable and populate the dataRow[] with the results.
I do it in a "for", In every loop the dataRow Length get bigger even
when
I
compare it to null before every loop.

"Ignacio Machin ( .NET/ C# MVP )" wrote:

Hi,

If you have a variant number of rows you better use ArrayList or
List<DataRow if possible.

what are you trying to do anyway?
--
--
Ignacio Machin,
ignacio.mach in AT dot.state.fl.us
Florida Department Of Transportation

"Niron kag" <Ni******@discu ssions.microsof t.comwrote in message
news:0C******* *************** ************@mi crosoft.com...
Hi,
I have a loop an in the loop I populate an array of dataRow.
My problem is the array keeps its values from previous loop, and its
Length
gets bigger every loop.
My code is:
DataRow[] foundRowsAct; sSQL ="SQL STATEMENT";
foundRowsAct = dtACTIVITIES.Se lect(sSQL);

I tried to write in the loop:
foundRowsAct=nu ll;

But it did not help.
What can I do to get a new array every loop?
Thanks in advance.




Jul 18 '06 #9

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

Similar topics

1
17029
by: Martin Lindn | last post by:
I got this example written by David J Gottlieb. Which will not compile. I have previously read in the xml doc with myDataSet.ReadXML(Server.MapPath("bills.xml")) Then when i com to this section.. Dim myTable As DataTable Dim myRow as DataRow
2
3282
by: Petez | last post by:
Hi, I want to declare array of System::Data::DataRow but how? With single variable I write System::Data::DataRow^ aRow but statement System::Data::DataRow^ - not works. System::Data::DataRow* - not works. System::Data::DataRow^^ - not works. I need this array for store result of DataTable->Rows->Select(...) Thanks, Peter
2
1624
by: Carlos K | last post by:
Hello I'm having some difficulty searching a set of rows in a DataRow collection.. This is my question What would be an efficient way to search any column of an DataRow array Let me try to explain the context of this question, that will help you understand what I'm looking for.. Assume that I have a collection of rows that came out of a...
5
1668
by: Geoff Jones | last post by:
Hi Suppose we have an array of DataRows e.g. Dim drMyRows() As DataRow = myTable.Rows(0).GetChildRows("PricesCompany") generated via a relationship. The question I have is this. Isn't this in essence a table i.e. a collection of rows? The reason I ask is that I wanted to extract from the array of rows
8
2267
by: Joe Rattz | last post by:
Ok, I can't believe what I am seeing. I am sure I do this other places with no problems, but I sure can't here. I have some code that is indexing into the ItemArray in a DataSet's DataRow. I basically want to change the value of the data stored at a particular index in the ItemArray. Ideally, I would like for my code to look like this...
5
11650
by: samoore33 | last post by:
I use the code below to search through a DataSet: Dim t As DataTable t = result.Tables("State") Dim strExpr As String strExpr = "id = '" & theState.ToString() & "'" Dim foundRows() As DataRow foundRows = t.Select(strExpr) This of course returns foundRows. My problem is that I need to return
3
11475
by: creator_bob | last post by:
How do I create an array of datarows from a sorted list? I put a bunch of datarows into a sorted list to sort them. Then I got an array of the sorted elements. However, I cannot typecast them. I get an invalid cast error. I notice that in the debugger, that arrays of datarows are listed as {Length=xx}, but my arrays are listed as...
1
3141
by: NiteshR | last post by:
Please Help! Hi, iv been struggling to figure this out for some time now. Im using visual studio 2005(C#). I want to declare an Array (Pre-defined) of datatype 'Datarow'. The code gets a value from a table and outputs the value to a cell in MS Excel. My code is as follow: // DataRow a = dt.Rows;
9
35769
by: myotheraccount | last post by:
Hello, Is there a way to convert a DataRow to a StringArray, without looping through all of the items of the DataRow? Basically, I'm trying to get the results of a query and put them into a listbox. Right now it is done like this:
0
7565
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, well explore What is ONU, What Is Router, ONU & Routers main...
0
7492
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...
0
7768
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8002
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...
1
7522
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7847
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...
0
6106
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 projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3520
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
804
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...

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.