Symbianize Forum

Most of our features and services are available only to members, so we encourage you to login or register a new account. Registration is free, fast and simple. You only need to provide a valid email. Being a member you'll gain access to all member forums and features, post a message to ask question or provide answer, and share or find resources related to mobile phones, tablets, computers, game consoles, and multimedia.

All that and more, so what are you waiting for, click the register button and join us now! Ito ang website na ginawa ng pinoy para sa pinoy!

Patulong naman sa Auto generate sa Id

Smartians143

Novice
Advanced Member
Messages
42
Reaction score
0
Points
26
:praise::praise: Hi! Sa Mga Symbians Puwede nyo ba Akong tulongan tungkol sa Auto - Increment sa ID ng Isang Emplooyess..
Using Java
:praise::praise: Sample Output
VCWD0001
VCWD0002
:pls::pls::pls: Thank in Advances.
 
Last edited:
TS hindi ako marunong ng java.. try mo to baka makatulong..

int myID = 0;
String eID = "VCWD";

Statement stmt = null;
String query = "select ID from EmployeesTable";
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);

while (rs.next()) {
int ID = rs.getInt("ID");
Strring num;
String[] ary = ID.split("");
for (int ctr = 4; ctr <= ary.length(); ctr = ctr + 1){
num = num + ary[ctr];
}
if (myID == Integer.parseInt(num){
myID = myID + 1;
}
}
switch (myID.length){
case 1:
eID = eID + "000";
break;
case 2:
eID = eID + "00";
break;
case 3:
eID = eID + "0";
break;
default:
eID = eID;
break;
}
eID = eID + Integer.toString(myID);

ang eID yan na ung gagamitin mo pra sa new data na iadd mo sa database..
 
TS hindi ako marunong ng java.. try mo to baka makatulong..

int myID = 0;
String eID = "VCWD";

Statement stmt = null;
String query = "select ID from EmployeesTable";
stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);

while (rs.next()) {
int ID = rs.getInt("ID");
Strring num;
String[] ary = ID.split("");
for (int ctr = 4; ctr <= ary.length(); ctr = ctr + 1){
num = num + ary[ctr];
}
if (myID == Integer.parseInt(num){
myID = myID + 1;
}
}
switch (myID.length){
case 1:
eID = eID + "000";
break;
case 2:
eID = eID + "00";
break;
case 3:
eID = eID + "0";
break;
default:
eID = eID;
break;
}
eID = eID + Integer.toString(myID);

ang eID yan na ung gagamitin mo pra sa new data na iadd mo sa database..


Salamat tol i try ko q. thank you talaga sa code.
 
Back
Top Bottom