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

an array in a hashtable

6
Dear all,

I have just changed my jdk, from JDK 1.5.0 to JDK 1.6.0, and also changed my Netbeans, from NB 4.0 to NB 5.0. Now, I have got a problem with my web application. Can anyone tell me, what is wrong with my code below:

-------------------

Hashtable resultHT = new Hashtable();
try {
OpenConnection();
stmt = con.createStatement();
stmt.execute(sqlQuery);
rs = stmt.getResultSet();

ResultSetMetaData rsmd = rs.getMetaData();
int numCols = rsmd.getColumnCount();
int baris = 1;
String strIsiKolom = new String();

while (rs.next()){
String[] isi = new String[numCols];
for (int i=1; i<= numCols; i++) {
strIsiKolom = rs.getString(i);
if (strIsiKolom.length()==0) {
strIsiKolom = "-";
isi[i-1] = strIsiKolom;
} else {
isi[i-1] = strIsiKolom;
}
}

resultHT.put(new Integer(baris), isi);
baris = baris + 1;
}

-------------------

When I used my NB 4.0 + JDK 1.5.0, this code didn't give any problem. But now, I get an error message... something like there is no data on my hashtable. I have failed to insert anything on the hashtable.

Can anyone help me???

Thanks.


Regards,
Novan Ananda
Sep 26 '07 #1
3 1603
madhoriya22
252 100+
Dear all,

I have just changed my jdk, from JDK 1.5.0 to JDK 1.6.0, and also changed my Netbeans, from NB 4.0 to NB 5.0. Now, I have got a problem with my web application. Can anyone tell me, what is wrong with my code below:

-------------------

Hashtable resultHT = new Hashtable();
try {
OpenConnection();
stmt = con.createStatement();
stmt.execute(sqlQuery);
rs = stmt.getResultSet();

ResultSetMetaData rsmd = rs.getMetaData();
int numCols = rsmd.getColumnCount();
int baris = 1;
String strIsiKolom = new String();

while (rs.next()){
String[] isi = new String[numCols];
for (int i=1; i<= numCols; i++) {
strIsiKolom = rs.getString(i);
if (strIsiKolom.length()==0) {
strIsiKolom = "-";
isi[i-1] = strIsiKolom;
} else {
isi[i-1] = strIsiKolom;
}
}

resultHT.put(new Integer(baris), isi);
baris = baris + 1;
}

-------------------

When I used my NB 4.0 + JDK 1.5.0, this code didn't give any problem. But now, I get an error message... something like there is no data on my hashtable. I have failed to insert anything on the hashtable.

Can anyone help me???

Thanks.


Regards,
Novan Ananda
Hi,
Plz use code tags while posting code.
Use System.out.println statments to test it where it is going wrong.
Sep 26 '07 #2
r035198x
13,262 8TB
Dear all,

I have just changed my jdk, from JDK 1.5.0 to JDK 1.6.0, and also changed my Netbeans, from NB 4.0 to NB 5.0. Now, I have got a problem with my web application. Can anyone tell me, what is wrong with my code below:

-------------------

Hashtable resultHT = new Hashtable();
try {
OpenConnection();
stmt = con.createStatement();
stmt.execute(sqlQuery);
rs = stmt.getResultSet();

ResultSetMetaData rsmd = rs.getMetaData();
int numCols = rsmd.getColumnCount();
int baris = 1;
String strIsiKolom = new String();

while (rs.next()){
String[] isi = new String[numCols];
for (int i=1; i<= numCols; i++) {
strIsiKolom = rs.getString(i);
if (strIsiKolom.length()==0) {
strIsiKolom = "-";
isi[i-1] = strIsiKolom;
} else {
isi[i-1] = strIsiKolom;
}
}

resultHT.put(new Integer(baris), isi);
baris = baris + 1;
}

-------------------

When I used my NB 4.0 + JDK 1.5.0, this code didn't give any problem. But now, I get an error message... something like there is no data on my hashtable. I have failed to insert anything on the hashtable.

Can anyone help me???

Thanks.


Regards,
Novan Ananda
Please post the exact error message you got.
Sep 26 '07 #3
JosAH
11,448 Expert 8TB
But now, I get an error message... something like there is no data on my hashtable.
So you want us to give you a clear answer given your extremely vague description
of the error diagnostic: "something likere there is no data". Big deal. If you want a
clear answer from us, please give us clear details about what displayed the error
diagnostic (the compiler? the virtual machine itself?) and what exactly was displayed.
(that only takes a copy and paste action).

kind regards,

Jos
Sep 26 '07 #4

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

Similar topics

1
by: Ante | last post by:
Hello Group. How can I create an array of Hashtables? I simply tried with Hashtable ht = new Hashtable; but when I put something into that array I get an nullpointer exception. ...
5
by: Denis Perelyubskiy | last post by:
Hello, I need to make an array of elements accross forms. My javascript skills, as evident from this question, are rather rudimentary. I tried to make an associative array and index it with...
2
by: Alfonso Morra | last post by:
I am implementing an application which requires the storage of a large number of items in a cache. I have 3-tuple key reprented by a struct, as well as an n-tuple (n is fixed) dataset, also...
0
by: gorden blom | last post by:
Hello, I'm working on a ASP.NET/C# school project and I'm having some difficulties. I'm trying to extract the values of an array, and print them to my screen. I've added the array to a...
9
by: Arjen | last post by:
Hello, Persons is a hashtable which I convert to an array. Person aPerson = new Person; Persons.Values.CopyTo( aPerson, 0 ); Now I can access the person items like aPerson.name or...
4
by: Laszlo Szijarto | last post by:
Thank you in advance, I am trying to populate a HashTable object with a value that's an array, but I don't want to put in two lines of code for each entry. rather than saying int value =...
19
by: Tom Jastrzebski | last post by:
Hello, I was just testing VB.Net on Framework.Net 2.0 performance when I run into the this problem. This trivial code attached below executed hundreds, if not thousand times faster in VB 6.0...
4
by: Jeff User | last post by:
Hi I thought I would try a hashtable for storing key and title value pairs. For instance, public class MyBasePAgeClass { Hashtable TitleHash = new Hashtable(); ........ private void...
16
by: John Kelsey | last post by:
Back in the "old" days with C, I used to do something like... struct { char Description; float price; } Items = { {"Apple", 1.99}, {"Banana", 2.04}
7
by: =?Utf-8?B?UmljYXJkbyBGdXJ0YWRv?= | last post by:
I have a big problem concerning arrays. I have an array of structs that is deply implemented in the code. If i change this implementation then i have to change everything, so after searching...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
0
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...

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.