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

arraylist problem

304 100+
i have two arraylists,
say arraylist1 and arraylist2.
now i keep adding items to both arraylists depending on some criteria.

now in some cases, arraylist2 may not have a value at a particular index while arraylist1 may have one.

later on when i add the values in the list to a database, i get an error saying that there is no value at that index for arraylist2 (its trivial that the error should show up).

i would like to know as to how i should check the arraylist2 to see if there is a value at that index or not.
Apr 8 '07 #1
2 849
shweta123
692 Expert 512MB
Hi,

How are you comparing the values of Arraylists before inserting into database?
If Arraylist2 only is containing No values you can check it this way,

for i=0 to arraylist1.count-1
if isDBNull(arraylist1.items(i))=true
''''''do some processing or insert empty string
end if
next
Apr 8 '07 #2
gomzi
304 100+
Hi,

How are you comparing the values of Arraylists before inserting into database?
If Arraylist2 only is containing No values you can check it this way,

for i=0 to arraylist1.count-1
if isDBNull(arraylist1.items(i))=true
''''''do some processing or insert empty string
end if
next
thx a lot..m currently using a try catch statement.
which do you think is better?
Apr 8 '07 #3

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

Similar topics

6
by: Stephen | last post by:
Im trying to carry work out an else if clause in the below method but i'm having a lot of difficulty getting the correct code which allows me to check and see if an arraylist items has text in it...
4
by: Hans De Schrijver | last post by:
I have a private ArrayList variable that holds objects of various types, though they're all derived from a common base class (User). What I would like to do is provide public accessor properties...
3
by: Stephen | last post by:
I was wondering if someone can help me with an web application design problem. I have a aspx page which builds up an arraylist called addresses and outputs the values in the arraylist items to a...
9
by: vbportal | last post by:
Hi, I would like to add BitArrays to an ArrayList and then remove any duplicates - can someone please help me forward. I seem to have (at leaset ;-) )2 problems/lack of understanding (see test...
9
by: Leon | last post by:
I have a webform in which when the user press generate button the form generate six unique ramdon numbers, the user can also type these six numbers in manually in any order. however, the user can...
20
by: Dennis | last post by:
I use the following code for a strongly typed arraylist and it works great. However, I was wondering if this is the proper way to do it. I realize that if I want to implement sorting of the...
0
by: Grant Wickman | last post by:
Our team has just fixed a really nasty problem that appears to be caused by an obscure bug in the sort method of Arraylist and daisy-chained webservice stubs. We've fixed the bug so I'll not...
18
by: Sam | last post by:
Hi All I'm planing to write an application which allows users dynamically add their points (say you can add upto 30,000) and then draw xy graph. Should I use an array for my coordinate point...
48
by: Alex Chudnovsky | last post by:
I have come across with what appears to be a significant performance bug in ..NET 2.0 ArrayList.Sort method when compared with Array.Sort on the same data. Same data on the same CPU gets sorted a...
8
by: amazon | last post by:
I have a following structure that I am using with array list: Private Structure arrayliststruct Public Name As String Public value As String Public type As String End Structure and following...
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: 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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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...

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.