Solving task 1 by 1 from bundle of task data

Solving task 1 by 1 from bundle of task data

Hello and namaste guys, i really need help here.i use ResultSet to query data from database. as we know, it query row by row using while (ResultSet()) this means, i have a lot of row.row means task.in each task, there will be an information like userid, Taskid, user_input

i have to use the information for eash task to solve the task it self.the problem im facing now is the code is just solve for the last data in result set.what should i do so that the solve code solve data 1 by 1?do i need to use array?what kind of array?

View Answers

April 7, 2011 at 3:16 PM

import java.sql.*;
import java.util.*;
class  Retrieve{
public static void main(String[] args){
    try{
           Class.forName("com.mysql.jdbc.Driver");
           Connection con = DriverManager.getConnection("jdbc:mysql://localhost:3306/test", "root", "root");
           Statement st=con.createStatement();
           ResultSet rs=st.executeQuery("select * from employee");

           ArrayList name=new ArrayList();
           ArrayList address=new ArrayList();
           ArrayList contact=new ArrayList();
           ArrayList email=new ArrayList();

           while(rs.next()){
             name.add(rs.getString("name"));
              address.add(rs.getString("address"));
              contact.add(rs.getInt("contactNo"));
              email.add(rs.getString("email"));
              }
           for(int i=0;i<name.size();i++){
           System.out.println(name.get(i)+"\t"+address.get(i)+"\t"+contact.get(i)+"\t"+email.get(i));
           }
    }
    catch(Exception e){
    System.out.println(e);
    }

    }
}

April 7, 2011 at 8:40 PM

using arraylist makes me more problem because i need to pass the value to the constructor.ive tried to change to single array,but got error.cannot find symbol constructor...

for(int i=0;i<count;i++)
                    {
                        String user_input = input[i];
                        int t_number = t_num[i];
                        String user_id = id[i];
                        int taskid = task_id[i];

                        Tway gen = new Tway(user_input , t_number , user_id , taskid);
                        gen.solve();

                     }

whats ive done wrong?

Ads









Related Tutorials/Questions & Answers:
Solving task 1 by 1 from bundle of task data
Solving task 1 by 1 from bundle of task data  Hello and namaste guys, i really need help here.i use ResultSet to query data from database. as we know... set.what should i do so that the solve code solve data 1 by 1?do i need to use
data insertion and fetch 1
data insertion and fetch 1  @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ <... rs = (ResultSet) request.getAttribute("data"); while...; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ insert int data base @@@@@@@@@ import
Advertisements
1 year data science masters
1 year data science masters  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year data... can learn the topic "1 year data science masters". Also tell me which
master data science in 1 month
master data science in 1 month  Hi, I am beginner in Data Science... data science in 1 month Try to provide me good examples or tutorials links so that I can learn the topic "master data science in 1 month". Also tell
1 year masters in data science
1 year masters in data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year... that I can learn the topic "1 year masters in data science". Also tell
data science 1 year masters
data science 1 year masters  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data... can learn the topic "data science 1 year masters". Also tell me which
data science 1 year course
data science 1 year course  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: data science... learn the topic "data science 1 year course". Also tell me which
1 year masters data science
1 year masters data science  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: 1 year... can learn the topic "1 year masters data science". Also tell me which
masters in data science 1 year
masters in data science 1 year  Hi, I am beginner in Data Science... in data science 1 year Try to provide me good examples or tutorials links so that I can learn the topic "masters in data science 1 year". Also tell
Generate random numbers from 1 to 100
Generate random numbers from 1 to 100  1)A class Called: RandomNumberGenerator that generate random numbers from 1 to 100 2)A class Test that tests... an object from the Random NumberGenerator class to generate your input test data
print the sum of even number from 1 to 100
print the sum of even number from 1 to 100  how to print the sum of even number from 1 to 100 using for loops? Thanks
How to Create Multiplication Table from 1 to 10?
How to Create Multiplication Table from 1 to 10?  Hi, I want... table 1 to 10. Please suggest online example related to creating multiplication table. Thanks   Hi, Did you want to create multiplication table 1
udemy master data science in 1 month
udemy master data science in 1 month  Hi, I am beginner in Data...: udemy master data science in 1 month Try to provide me good examples or tutorials links so that I can learn the topic "udemy master data science in 1
1 year masters programs in data science
1 year masters programs in data science  Hi, I am beginner in Data...: 1 year masters programs in data science Try to provide me good examples or tutorials links so that I can learn the topic "1 year masters programs
display the hidden text from that row, when onclick on a row of 1- 10
display the hidden text from that row, when onclick on a row of 1- 10  Using JSP: I'm displaying a set of values from the databse in a table rows (1... created to show: <TABLE cellpadding="15" border="1" style="background-color
task
ModuleNotFoundError: No module named 'task'
ModuleNotFoundError: No module named 'task'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'task' How to remove the ModuleNotFoundError: No module named 'task' error
ModuleNotFoundError: No module named 'task'
ModuleNotFoundError: No module named 'task'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'task' How to remove the ModuleNotFoundError: No module named 'task' error
contructors 1&test
contructors 1&test   how do i Create a class named Box that includes integer data fields for length, width and height. Create three constructors... created with length 10 and width 15. Box created with length 1, width 2
Ajax Question 1
Ajax Question 1  I am having 3 fields in jsp they are Fieldname,Fieldtype,Required. If i enter Fieldname as studentid,Fieldtype as checkbox,Required.... From database it should displays the following jsp page as output page by using
Tags in struts 1
Tags in struts 1   I have problem in Include tag in Struts this tag using but it is not work Please Explain
C++ quuestion 1
C++ How to dispaly details for students and Create object for student class and input dispaly details   1.Create a class called student with following descriptions Data member : Rno - int Name - char[20] Std - int Mark1 int
java code7 of 1
java code7 of 1  Develop the program calculateHeight, which computes the height that a rocket reaches in a given amount of time. If the rocket accelerates at a constant rate g, it reaches a speed of g ?· t in t time units
java code 8 of 1
java code 8 of 1  Develop a program that computes the distance a boat travels across a river, given the width of the river, the boat's speed perpendicular to the river, and the river's speed. Speed is distance/time
java code 1 of 2
java code 1 of 2  Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff. acceptClothes accepts the noofClothes as argument & returns the noofClothes   Hi Friend, Visit
java program 1
java program 1  (4) WAP to take input of a String and check wheather it is valid number or not? Sample Output1: Enter a String : 10 10 is a number Sample Output2: Enter a String : 10b1 10b1 is not a number (5) WAP to take
java code 1 of 2
java code 1 of 2  Create a washing machine class with methods as switchOn, acceptClothes, acceptDetergent, switchOff. acceptClothes accepts the noofClothes as argument & returns the noofClothes   Hi Friend, Try
Java Timer Task
Java Timer Task  How to assign a task in java at specified date & time (with seconds) using threads
1 year masters in artificial intelligence
1 year masters in artificial intelligence  Hi, I am beginner in Data...: 1 year masters in artificial intelligence Try to provide me good examples or tutorials links so that I can learn the topic "1 year masters
New Page 1
;= 1; i <= 9; i++){   for(var j = 1
New Page 1
lost focus from the text box, onBlur() event occurs and specified function... can see from the above code that we have invoked the addFName() method...; Output : As soon as we lost focus from the very first

Ads