if file('ghor_1.dbf') drop table ghor_1 endif if not file('ghor_1.dbf') create table ghor_1 (location character(15),district character(15),; ward character(15),unit character(5),area int,demand_note date,; last_invoice_date date,next_invoice_date date,agreement_date date) endif //If you have an existing table delete or comment out the above. //The field names are not used in the code below so it doesn't //matter if you have used different field names //Edit the values for cTable and cCSV to suit. cTable = 'ghor_1' cCSV = 'ghor.csv' cDate = set('date') //save date format set date to american //dates in .csv are in American format set procedure to :duflp:stringex.cc q = new query() q.sql = "select * from "+cTable q.active = true f = new file() f.open(cCSV) cRead = f.gets(100000) // Skip record with field names do while not f.eof() cRead = f.gets(100000) aRecord = new stringex(cRead).breakstring(",",true) q.rowset.beginAppend() for n = 1 to aRecord.size if q.rowset.fields[n].type = 'DATE' q.rowset.fields[n].value = ctod(aRecord[n]) else //all numeric and character field types can simply be saved q.rowset.fields[n].value = aRecord[n] endif next q.rowset.save() enddo f.close() q.active = false close procedure :duflp:stringex.cc msgbox('Done') set date to &cDate // set date format back to original