Click here to Skip to main content
15,886,037 members

How to get collection of data from database

Revision 5
Hi
Code below as I see it get specific value from database. What do you use to get the collection of all values inside your tables

Java
resultSet = statement.executeQuery("SELECT password,username FROM tbl_Credantials");
            while (resultSet.next())
            {
                  String userName = resultSet.getString("username ");

            }


I need something that works the same as this code below

Java
OleDbCommand cmd = new OleDbCommand("SELECT * FROM tbl_Credantials", con);


                DataTable dTable = new DataTable();
                OleDbDataAdapter adapter = new OleDbDataAdapter(cmd);
                adapter.SelectCommand = cmd;
                adapter.Fill(dTable);

                return dTable;
Posted 24-Sep-12 7:44am by Anele Ngqandu.