below i post my code :
import java.util.*;
import java.sql.*;
import java.io.*;
import com.hxtt.sql.*;
public class backofficeDbfVerification {
Connection connection;
/** Creates a new instance of backofficeDbfVerification */
public backofficeDbfVerification(String path, Properties prop) throws SQLException {
try {
Class.forName("com.hxtt.sql.dbf.DBFDriver");
connection = DriverManager.getConnection("jdbc:DBF:/"+path, prop);
}
catch (ClassNotFoundException classnotfoundexception) {
System.out.println("could ot find HXTT class, make sure the classpath have been defined in your system !");
}
}
public void createGoodRecord(String table, int blth) throws SQLException {
Statement stmt = connection.createStatement();
String delete = "delete from '"+table+"' where VAL(substring(blth,3,4)+substring(blth,1,2)) < "+blth;
boolean bdelete = stmt.execute(delete);
stmt.close();
connection.commit();
}
public ResultSet querySomeData(String table) throws SQLException {
Statement stmt = connection.createStatement();
String query = "select * from '"+table+"' where VAL(substring(blth,3,4)+substring(blth,1,2)) < 200310";
ResultSet result = stmt.executeQuery(query);
return result;
}
public static void main (String args[]) {
Properties pp = new Properties();
pp.setProperty("user", "");
String path = "C:\\JATIM\\MLPOV2\\DKI\\temp\\SOREK";
String pathCopy = "C:\\JATIM\\MLPOV2\\DKI\\source\\SOREK";
try {
backofficeDbfVerification test = new backofficeDbfVerification(path, pp);
test.createGoodRecord("5462154", 200310);
}
catch(SQLException sqx) {
System.out.println("Error "+sqx.getMessage());
}
}
}
when i perform delete action, no record deleted form the file (the record still exist as i check the table using visual foxpro), but no record are retrieved too when i perform method querySomeData().
i really don't know what exactly happens, the record still exists after i deleted them, but norecords retrieved from query action....
please help...
|
Because those rows are just marked with a DELETED flag according to Xbase stanadard, so that VFP can see those deleted rows. If you wish to remove those deleted rows permanently, you should use "PACK TABLE yourTable;" once.
|