DBF Files lazarus / 16-Databases ---------------------------------------------------------------------- jcedillo · 2015-10-21 17:51 Hello everyone: I'm working with a DBF file with 20 records, I want to move the content to a TXT file. All goes well; however, it exports only two records. Debugging, the FileDBF.First command is not placed in the initial record, is placed in the 19th  , only exports the records 19 and 20  . What am I doing wrong? Can someone help me out? Greetings and thanks. ---------------------------------------------------------------------- paweld · 2015-10-21 18:02 try Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i Dbf1.ShowDeleted:=True;Maybe records 1-18 is deleted. ---------------------------------------------------------------------- Handoko · 2015-10-21 18:16 Quote from: jcedillo on October 21, 2015, 07:51:02 pmWhat am I doing wrong? Can someone help me out? Many people here can help you. But without inspecting your code, we can't know what you did wrong. Can you please show us the code? ---------------------------------------------------------------------- jcedillo · 2015-10-27 19:29 procedure TfrmCalMySql.crear_salida(); // Crea archivo de texto con las consultas SQL. var   dFechas: misfechas;   sFechaMySql: string;   fSalida: TextFile;   sSalida: string;   nNumero: integer;   nCalifica: double; begin   dFechas.create;   AssignFile(fSalida, sMRuta);   Rewrite(fSalida);   Writeln(fSalida, 'DELETE FROM asistira WHERE ' + sCondicion);   servacad.Active := true;   servacad.Open;   servacad.ShowDeleted := true;  // sugerencia, no funcionó.    servacad.First;   nNumero := servacad.RecNo;  // = 19    nNumero := servacad.RecordCount; // = 20    while not servacad.eof do   begin     sSalida := 'INSERT INTO asistira VALUES(' + IntToStr(servacad.FieldValues['cve_estud']) + ', "';     sSalida := sSalida + servacad.FieldValues['cve_curso'] + '", "';     // Verifica los valores nulos del campo.     if (servacad.FieldValues['gpo_670'] <> null) then       sSalida := sSalida + servacad.FieldValues['gpo_670'] + '", '     else       sSalida := sSalida + ' ' +  '", ';     // Se asigna el valor del campo a una variable conocida Double (que maneja).     nCalifica := servacad.FieldValues['califica'];     sSalida := sSalida + FloatToStrF(nCalifica,ffGeneral,2,1) + ', ';     sSalida := sSalida + IntToStr(servacad.FieldValues['creditos']) + ', "';     sSalida := sSalida + servacad.FieldValues['periodo'] + '", ';     sSalida := sSalida + IntToStr(servacad.FieldValues['agno']) + ', "';     // Verifica que no sea nulo el campo.     if (servacad.FieldValues['observa'] <> null) then       sSalida := sSalida + servacad.FieldValues['observa'] + '", "'     else       sSalida := sSalida + ' ' + '", "';     // Utiliza funciones de fechas para pasar al formato MySQL     // verifica que la fecha no sea nula.     if (Not (servacad.FieldByName('f_registro').IsNull)) then       sFechaMySql := dFechas.fecha_mysql(servacad.FieldValues['f_registro'])     else       sFechaMySql := '0000/00/00';     sSalida := sSalida + sFechaMySql + '", "';     sSalida := sSalida + servacad.FieldValues['per_vi_cur'] + '", ';     sSalida := sSalida + IntToStr(servacad.FieldValues['ano_vi_cur']) + ');';     writeln(fSalida, sSalida);     servacad.Next;   end;   servacad.Close;   servacad.Active := false;   CloseFile(fSalida); end; ---------------------------------------------------------------------- Handoko · 2015-10-27 19:59 I ever had similar issue. Unfortunately, I now forget how I solved it. But here is the discussion I posted some years ago: http://forum.lazarus.freepascal.org/index.php?topic=6417.0 Also, I just checked the TDbf documentation. It said: QuoteExamine PhysicalRecNo to determine the physical record number for the current record. It can be set to position the cursor on that record. The difference to RecNo is that reading RecNo returns the sequential record number which is the same if no indexes are active, but could be different if there is an index active. Did the dbf use any index?