Jump to content

haentschman

Members
  • Content Count

    213
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by haentschman

  1. haentschman

    SQL problem

    ...no. FDQuery1.SQL.Text := 'select * from tab where code LIKE :Code'; FDQuery1.ParamByName('code').AsString := '%123%'; FDQuery1.Open; ...the "%" is in the parameter! Other Example: Qry.ParamByName('REN').AsString := '%[_]' + Pair.Key + '[_]' + Pair.Value + '%';
  2. haentschman

    SQL problem

    by the way... FDQuery1.SQL.add('WHERE (MainDirectory LIKE ''%' + Edit1.Text + '%'') OR INSTR(''' + Edit1.Text + ''', MainDirectory) > 0' ); you know what SQL Injection is? https://en.wikipedia.org/wiki/SQL_injection The german site is better... With delphi examples: https://de.wikipedia.org/wiki/SQL-Injection πŸ™„ Always use parameters!
  3. haentschman

    How to 'disconnect' a TFDQuery keeping the datas.

    Hi... That's why the components are called "data sensitive". Without a direct connection to the database you have no data.... (unless there is something new ) You have to come up with a separation of data and database. Variant 1: 1. load data with query 2. transfer the data into objects 3. throw away query 4. change data in object 5. save object with SQL (create query, throw away query) ... with this variant one gets along also without data-sensitive components. You can then display an object in the grid as well as a property in the edit. Variant 2: Copy to another dataset: https://docwiki.embarcadero.com/Libraries/Sydney/en/FireDAC.Comp.DataSet.TFDDataSet.CopyDataSet Imho there are other variants....
  4. haentschman

    Zip Compression library

    Hi... https://componentace.com/zipforge_features.htm I use it to make zip of a MSSQL database backup. All others stop at 2GB. 6GB -> 1GB For Single Developer with Source Code $149
  5. haentschman

    ExtractFilePath v TDirectory.GetCurrentDirectory

    Hi... https://docwiki.embarcadero.com/Libraries/Seattle/en/System.IOUtils.TDirectory.GetCurrentDirectory Current working directory: 99% <> ExtractFilePath(Application.ExeName) Example: Current working directory can be "C:\Windows\System32" or else a special folder...
  6. haentschman

    Write image to database

    ...learning by doing. 😎 You can also adapt the example to your circumstances. Release of the stream. etc.
  7. haentschman

    Write image to database

    ...see editing ...is my case. Sometimes i read the Picture to a new object (Picture = nil)
  8. haentschman

    Write image to database

    Hi...😎 try this...πŸ˜‰ if not Qry.FieldByName('Picture').IsNull then begin Stream := TMemoryStream(Qry.CreateBlobStream(Qry.FieldByName('Picture'), bmRead)); try Contact.Picture := TMemoryStream.Create; Contact.Picture.LoadFromStream(Stream); finally Stream.Free; end; end; before...Contact.Picture = nil πŸ˜‰
  9. haentschman

    Change of coding style/structure..

    Hi... ...this is right. πŸ˜‰ ...but the language has also changed. "with" is 90's. The "new" TRect was imho the first problem in this case. The structure of TRect was changed. Some "with" had the false scope...AccessViolation. The biggest problem with "with" is: with TTaskDialog.Create(Self) do try Title := 'Warning!'; Text := GetTextFromFunction; CommonButtons := [tcbOk]; Execute; finally Free; end; ...and now you set a breakpoint on "Excecute". Then read the variable content from "Text" under the mouse...you see nothing. More Info ( June 26, 2007 ) https://blog.marcocantu.com/blog/with_harmful.html
  10. haentschman

    Change of coding style/structure..

    In the modern Delphi...always NO. see uses TRect - https://stackoverflow.com/questions/71419/why-should-i-not-use-with-in-delphi ...and other. procedure MainForm.ButtonClick(Sender: Object) begin with TMyForm.Create(nil) do try ShowModal; finally Free; end; ...this means a rebuild of the code if complexity increases...why not "right" with instance variable. ...and the variable display in the debugger does not work. I am out of this discussion...
  11. haentschman

    DBRadiobutton

    Clear... I have only TForm1 always renamed to foBlubb etc.
  12. haentschman

    DBRadiobutton

    ...
  13. haentschman

    wuppdi Welcome Page for Delphi 11 Alexandria?

    Hi... @gkobler: ...thanks But...for the community: please without advertising (link) in the header ...then i install tis to.
  14. haentschman

    Best way to store data

    Hi...😎 1. multiuser? 2. server?...other maschine? 3. persistent data? ...or daily? 4. program crash? ...which data?
  15. haentschman

    SqllocalDB

    Hi...😎 Show the connection string...
  16. Hi... ...bevore LSP yes. With SLP (D11) not so good. Sometimes Ok, sometimes fail...πŸ˜• PS: i am a fan of this code completion πŸ˜‰ ...but so not. πŸ™„
  17. haentschman

    I solved my problem but

    Hi... ...always try/finally! In case of error IdHTTP.free is not executed because skipped to the end Better: IdHTTP := TIdHTTP.Create(nil); try try S := IdHTTP.Get(Link); result := S; except ShowMessage('Could not get VERSION information'); end; finally IdHTTP.Free; end;
  18. i had problems with this...Windows Defenderο»Ώ is imho good and enough... ...but now back to the topic.
  19. ...why? 🀒 (only my opinion)
  20. Hi... ...location of the dll?
  21. haentschman

    MessageDlg, mtConfirmation Wrong After Delphi 10.4

    Hi...πŸ˜‰ How about using a own TForm as a MessageDlg? ...own design, formatted texts (TStringlist etc.), own icons? 😎
  22. haentschman

    FB-3 SELECT WHERE

    Hi... NOT with WITH: with TFDQuery.Create(self) do
  23. haentschman

    ImageLists. One or Multiple??

    Hi... ...+1
  24. haentschman

    What is good replacement for FastReports?

    ...nothing. 😎 Why you want to change?
  25. haentschman

    Syntax error in From clause

    Hi...πŸ˜‹ ...not query?
Γ—