problem with the update of several data in the column ADR_PLZ_NEU after examination.
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   didier_tete
Posted On:   Saturday, April 27, 2002 06:08 AM

have problem with the update of several data in the column ADR_PLZ_NEU after examination. I could do only a worth apdate.I think which I a loop . please help mir public class DbConnectionClass extends Object { // Variablen protected static Connection sqlConn = null; protected static PreparedStatement prStmt = null; protected static ResultSet sqlRes = null; protected static Statement sqlStmt = null; protected static String strSelApoDPlz = null; protected static String sqlSelect = null; protected static String strPlz = null; /** * Creates new DbConnectionClass */ publi   More>>

have problem with the update of several data in the column ADR_PLZ_NEU after

examination. I could do only a worth apdate.I think which I a loop . please help mir


public class DbConnectionClass extends Object {

// Variablen

protected static Connection sqlConn = null;

protected static PreparedStatement prStmt = null;

protected static ResultSet sqlRes = null;

protected static Statement sqlStmt = null;

protected static String strSelApoDPlz = null;

protected static String sqlSelect = null;

protected static String strPlz = null;




/**

* Creates new DbConnectionClass

*/

public DbConnectionClass() {

readApoDPLZ(strSelApoDPlz);

updatApoDPlz();

}



/**

* Read Data

*/

public String readApoDPLZ(String strNeuApoDPlz){

this.strSelApoDPlz = strNeuApoDPlz;

String addstrSelApoDPlzE ="0000";

String addstrSelApoDPlzZ ="000";

String addstrSelApoDPlzD ="00";

String addstrSelApoDPlzV ="0";

try{

String driverName="sun.jdbc.odbc.JdbcOdbcDriver";

Class.forName(driverName);

sqlConn = DriverManager.getConnection("jdbc:odbc:sqlserver","","");

sqlStmt = sqlConn.createStatement();

System.out.println(" Hallo DIALOG MELDUN: DB-Driver gefunden!");

}

catch(ClassNotFoundException err){

System.err.println("Hallo DIALOG MELDUN: DB-Driver nicht gefunden!");

System.err.println(err);

}

catch(SQLException err){

System.err.println("Hallo DIALOG MELDUN: Connection nicht möglich");

System.err.println(err);

}

try{

sqlSelect = "SELECT APO_PLZ FROM APO_D";

sqlStmt = sqlConn.createStatement();

sqlRes = sqlStmt.executeQuery(sqlSelect.toString());

while(sqlRes.next())

{

strPlz = sqlRes.getString(1);

if(strPlz.length() == 1)

{

strPlz = addstrSelApoDPlzE + strPlz;

}

if(strPlz.length() == 2)

{

strPlz = addstrSelApoDPlzZ + strPlz;

}

if(strPlz.length() == 3)

{

strPlz = addstrSelApoDPlzD + strPlz;

}

if(strPlz.length() == 4)

{

strPlz = addstrSelApoDPlzV + strPlz;

}

if(strPlz.length() == 5)

{

strPlz = strPlz;

}

}

}

catch(SQLException err){

System.out.println("Fehler: Hallo DIALOG MELDUN sqlSelect
"+err.getMessage());

}

return strSelApoDPlz;

}



/**

*Update several data

*/

public String updatApoDPlz(){

try{

prStmt = sqlConn.prepareStatement(" UPDATE APO_D SET ADR_PLZ_NEU= ? ");

prStmt.setString(1, strPlz);

prStmt.executeUpdate();

sqlConn.commit();

System.out.println(strPlz);

}

sqlStmt.close();

}

catch(SQLException err){

System.out.println("DIALOG UPDAT FEHLERMELDUM
"+ err.getMessage());

}

return strPlz;

}


/**

* @param args the command line arguments

*/

public static void main(String[] args){

new DbConnectionClass();

}

}

   <<Less
About | Sitemap | Contact