public void closeDBFAll() { cOleDBCommand oleDbCommand = new cOleDBCommand(); oleDbCommand.setConStr(); oleDbCommand.oleDBQueryNonReturn("CLOSE DATABASES ALL"); }
public void updateDBFQuery(List <setDBFValues> setColumnValues) { cOleDBCommand oleDbCommand = new cOleDBCommand(); string updateSQL = ""; string[] editCol = _fields.Split(','); string[] editVal = _values.Split(','); updateSQL = "UPDATE " + _tblName + " SET "; oleDbCommand.setConStr(); oleDbCommand.setOleDbfValues(ref setColumnValues); for (int x = 0; x < editCol.Count(); x++) { if (updateSQL != "UPDATE " + _tblName + " SET ")//used to get first col & value { updateSQL = updateSQL + " , "; } updateSQL = updateSQL + editCol.ElementAt(x) + " = " + editVal.ElementAt(x); } updateSQL = updateSQL + " WHERE " + _condition; oleDbCommand.oleDBQueryNonReturn(updateSQL); }
public void insertDBFQuery(List <setDBFValues> setColumnValues) { cOleDBCommand oleDbCommand = new cOleDBCommand(); string insertSQL = ""; int countColumns = 1; oleDbCommand.setConStr(); oleDbCommand.setOleDbfValues(ref setColumnValues); insertSQL = "INSERT INTO " + _tblName + " (" + _fields + ") VALUES("; //+ _values + ")"; foreach (setDBFValues oDbfValues in setColumnValues) { if (countColumns > 1) { insertSQL = insertSQL + " , "; } insertSQL = insertSQL + oDbfValues.valueName; countColumns++; } insertSQL = insertSQL.Replace('\r', ' ').Replace('\n', ' ') + ")"; //MessageBox.Show(insertSQL); try { oleDbCommand.oleDBQueryNonReturn(insertSQL); } catch (Exception ex) { // MessageBox.Show(insertSQL); MessageBox.Show(ex.ToString()); } }
public void setDBFSequenceNo(string seq_code, string seq_newnum) { string incrementSQL = ""; //int newSequencenum = Convert.ToInt16(seq_newnum) + 1; int newSequencenum = Convert.ToInt16(seq_newnum); //edited for updating sequence.dbf file skipping 1 number incrementSQL = "UPDATE sequence SET seq_num= " + newSequencenum.ToString() + " WHERE seq_code='" + seq_code + "'"; cOleDBCommand oleDbCommand = new cOleDBCommand(); oleDbCommand.setConStr(); oleDbCommand.oleDBQueryNonReturn(incrementSQL); }