HI Guys !~
Before looking at the code below let me explain somethings here.
I am parsing a flat file and storing values for each column(of single line) in a temporary array called
"value[]".
Now I have to insert these values in my database depending on the fact that the record exists or not in the database.
So I am comparing the first column value, which is contained in value[0] with the primary key field value of my
relevant table("Constituent_Id" in this case). If it exist it skips that line in flat file and if doesn't than inserts
that record.
Now my problem is very basic here, the code which I am using for finding out whether the key value is already there in the database is given below but it's not working. One reason which I feel is that method
'equals()' can only be used with Object parameters, where as
'value[0]' is
String here..I don't know if I am correct but I cannot figure out how to go about. Please give me some clue on how to do it?
The main idea is to get the loop working properly after that I can put in any statement within the if block
while (rsConstituent.next()) {
String num = rsConstituent.getString("Constituent_Id");
if (num.equals(value[0])) {
out.println(num);
} else {
out.println("no");
out.println("This is:" + value[0]);
}
}
LEGEND: value[] -- is a String array
ThanX
Manoj