I have imported a .csv database file that lists the users of the program, along with other information in the form : UserName, Password, PropertyName, EstimatedValue.
I have figured how to get the username but it will only read the last username on the database and not the others. Help would be greatly appreciated.
import java.util.*;
import java.io.*;
public class readCSV
{
String[] userData;
public void checkLogin() throws IOException
{
try
{
File file = new File("C:/Users/Sean/Documents/Programming assigment/Users.csv");
BufferedReader bufRdr = new BufferedReader(new FileReader(file));
String lineRead = bufRdr.readLine();
while(lineRead != null)
{
this.userData = lineRead.split(",");
lineRead = bufRdr.readLine();
}
bufRdr.close();
}
catch(Exception er){
System.out.print(er);
System.exit(0);
}
}
}
whileloop, so only the last iteration will stay permanent.String[]is not a good choice as the data structure.