This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
I have split your post into its own thread. It's better to create your own original one than to hijack a five year old one.
Also, it's a good idea to post the full and complete error message. It is probably telling you exactly what is wrong. on line 6 of your code, you have an integer ARRAY on the left side, and an int on the right side. you can't do that.
if you just want the value, then take out the ""
int psage = Integer.parseInt(sl[i]);
if you need to store more than one and really do need the array, you need to a) first declare the array outside the loop with a size, and b) indicate which slot in the array you want to store your int.
There are only two hard things in computer science: cache invalidation, naming things, and off-by-one errors
Joined: Dec 24, 2012
Fred thank you very much ....your reply made me think once again over my block of code and i got my mistake.
the error was in line 6 as pointed by you.
Now i am able to insert the data into the database.
i would like to share the code that will help to insert multiple rows into the database using textboxes with same names i.e txtpsngrnm,psngrsex,psngrage are the names of the textboxes.
stmt.executeQuery("insert into fbook(fbid,fpname,fpage,fpgender) values('"+j+"','"+pname[j] +"','"+psage[j]+"','"+pgender[j]+"')");