Topic: adding a date?

[codeprocedure Form1_Button6_OnClick (Sender: string; var Cancel: boolean);
var
   OpenDialog: TOpenDialog;
   sl: TStringList;
   arrStr: array of string;

   i,c: integer;
   q: integer;
begin
     OpenDialog := TOpenDialog.Create(Form1);
     OpenDialog.InitialDir := ExtractFileDir(Application.Exename);

     if OpenDialog.Execute then
     begin
          sl := TStringList.Create;
          sl.LoadFromFile (OpenDialog.FileName);
           c := sl.Count - 1;
          for i := 0 to c do
          begin
               arrStr := SplitString(sl[i], ';');

               // prodotto
               if arrStr[0] <> '' then arrStr[0] := ''''+ ReplaceStr(arrStr[0], '''', '''''') + ''''
                   else arrStr[0] := 'NULL';

               // categoria
               if arrStr[1] <> '' then arrStr[1] := ''''+ ReplaceStr(arrStr[1], '''', '''''') + ''''
                   else arrStr[1] := 'NULL';
               // prezzo
               if arrStr[2] <> '' then arrStr[2] := ''''+ ReplaceStr(arrStr[2], '''', '''''') + ''''
                   else arrStr[2] := 'NULL';
               // pezzi
               if arrStr[3] <> '' then arrStr[3] := ''''+ ReplaceStr(arrStr[3], '''', '''''') + ''''
                   else arrStr[3] := 'NULL';

              q := SQLExecute('SELECT COUNT(*) FROM prodotti WHERE prodotto=' + arrStr[0] + ' AND  categoria='+ arrStr[1] + ' AND  prezzo='+ arrStr[2]+ ' AND  pz='+ arrStr[3] );
              if q > 0 then Continue;

               SQLExecute ('INSERT INTO prodotti (prodotto, categoria, prezzo, pz) VALUES ('+ arrStr[0] +','+ arrStr[1] +','+ arrStr[2] +','+ arrStr[3]+')');


               Form1.Label1.Caption := IntToStr(i+1) + ' of ' + IntToStr(c+1);
               Application.ProcessMessages;
          end;
                                                        


          sl.Free;
          Form1.TableGrid5.dbUpdate;
     end;
     OpenDialog.Free;

end.
Domebil

Re: adding a date?

How can I add a date?

Domebil

Re: adding a date?

Please check out this example:
http://myvisualdatabase.com/forum/misc. … download=1

Dmitry.