Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- struct UserHeader {
- int id;
- String username;
- String password;
- String fullname;
- String role;
- String boxid;
- } userHeader;
- void createRecordUserHeader(int num_recs, String username, String password, String fullname, String role, String boxid)
- {
- Serial.println("Creating User Header Record... ");
- correctId++;
- Serial.print("Correct id: ");
- Serial.println(correctId);
- Serial.print("username: ");
- Serial.println(username);
- Serial.print("Fullname: ");
- Serial.println(fullname);
- Serial.print("Password: ");
- Serial.println(password);
- userHeader.id = correctId;
- userHeader.username = username;
- userHeader.password = password;
- userHeader.fullname = fullname;
- userHeader.role = role;
- userHeader.boxid = boxid;
- EDB_Status result = db.appendRec(EDB_REC userHeader);
- if(result != EDB_OK) printError(result);
- Serial.println("DONE");
- }
- void selectAll()
- {
- Serial.println("DBCount: ");
- for (int recno = 1; recno <= db.count(); recno++)
- {
- int totalRecno = db.count();
- Serial.print(totalRecno);
- EDB_Status result = db.readRec(recno, EDB_REC userHeader);
- if (result == EDB_OK)
- {
- Serial.print("Recno: ");
- Serial.print(recno);
- Serial.print(" ID: ");
- Serial.print(userHeader.id);
- Serial.print(" Name: ");
- Serial.print(userHeader.fullname);
- Serial.print(" Boxid: ");
- Serial.print(userHeader.boxid);
- Serial.print(" Role: ");
- Serial.print(userHeader.role);
- Serial.print(" username: ");
- Serial.print(userHeader.username);
- Serial.print(" password: ");
- Serial.println(userHeader.password);
- }
- else printError(result);
- }
- }
- createRecordUserHeader(1, "brixs", "password1234", "Nicholson Secretary", "admin", "7456789");
- createRecordUserHeader(1, "mar", "ponsie", "Mar Roxas Ponsie", "user", "7543456");
- createRecordUserHeader(1, "user123", "password4321", "Lebron Pascual", "user", "6572123");
- selectAll(); //Select All Records
Add Comment
Please, Sign In to add comment