473,326 Members | 2,173 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,326 software developers and data experts.

duplicate entries in array

Hey Guys,
I really need some assistance with this code I'm writing,

(Just a portion of the entire code)
Expand|Select|Wrap|Line Numbers
  1. while (readCurrency.Read())
  2. {
  3.     ci.currencyCode = readCurrency[0].ToString();
  4.     ci.currencyName = readCurrency[1].ToString();
  5.     ci.currencyPrecision = Convert.ToInt32(readCurrency[2].ToString());
  6.     ciArr.SetValue(ci, count);
  7.     count++;
  8. }
here, the reader holds a collection of records, but the problem is that after each read operation, the new record replaces the other values already stored in all previous index of the array.

This is really giving me lots of issues, all assistance would be greatly appreciated.
Thanks in advance.
Sep 10 '07 #1
1 1038
Frinavale
9,735 Expert Mod 8TB
Hey Guys,
I really need some assistance with this code I'm writing,

(Just a portion of the entire code)
Expand|Select|Wrap|Line Numbers
  1. while (readCurrency.Read())
  2. {
  3.     ci.currencyCode = readCurrency[0].ToString();
  4.     ci.currencyName = readCurrency[1].ToString();
  5.     ci.currencyPrecision = Convert.ToInt32(readCurrency[2].ToString());
  6.     ciArr.SetValue(ci, count);
  7.     count++;
  8. }
here, the reader holds a collection of records, but the problem is that after each read operation, the new record replaces the other values already stored in all previous index of the array.

This is really giving me lots of issues, all assistance would be greatly appreciated.
Thanks in advance.
I don't know why this code isn't working for you...unless you haven't correctly initialized the value of your count variable.

Check to make sure that your variable count is set to the size of your ciArr variable before going into the while loop.

(I'd almost suggest trying out an ArrayList and just using the Add method to add your ci object to a list...this could avoid problems with the size limitations while using arrays...and it would eliminate your need for the count variable)

Hope this helps

-Frinny
Sep 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Gary Lundquest | last post by:
I have an application with MS Access 2000 as the front end and MySQL as the back end. All was well until I upgraded the MySQL (Linux) server. The Problem: I insert data into a cumulative table....
1
by: Gary Lundquest | last post by:
It appears to me that MySQL version 4 returns an error messge when doing an Insert that results in duplicate entries. Version 3 did NOT return an error - it dropped the duplicate entries and ran...
3
by: andreas.maurer1971 | last post by:
Hi all, since a few years I use the following statement to find duplicate entries in a table: SELECT t1.id, t2.id,... FROM table AS t1 INNER JOIN table AS t2 ON t1.field = t2.field WHERE...
5
by: Chris Lasher | last post by:
Hello Pythonistas! I'm looking for a way to duplicate entries in a symmetrical matrix that's composed of genetic distances. For example, suppose I have a matrix like the following: A B ...
5
by: Manish | last post by:
The topic is related to MySQL database. Suppose a table "address" contains the following records ------------------------------------------------------- | name | address | phone |...
1
by: JTreefrog | last post by:
Hello - I've read a ton of stuff about deleting duplicate values in an array. They are all very useful - they just haven't addressed an array of objects. Here's my array: var sDat = ; The...
2
by: ericnyc | last post by:
Hi, I am a newbee in C++ Please review this is what I wrote , what so ever I understood so far, My question is that I have to " Write a program C++ array that reads in an integer number and...
1
by: gaikokujinkyofusho | last post by:
Hi, I have been enjoying being able to subscribe to RSS (http://kinja.com/user/thedigestibleaggie) for awhile and have come up with a fairly nice list of feeds but I have run into an annoying...
12
by: joestevens232 | last post by:
Hello Im having problems figuring out how to remove the duplicate entries in an array...Write a program that accepts a sequence of integers (some of which may repeat) as input into an array. Write...
4
by: ramdil | last post by:
Hi All I have table and it have around 90000 records.Its primary key is autonumber field and it has also have date column and name, then some other columns Now i have problem with the table,as my...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.