-
Content Count
311 -
Joined
-
Last visited
-
Days Won
1
Posts posted by Serge_G
-
-
20 hours ago, Blavatsky said:This might seem like a silly question but can you run Firebird 3 (32 bit ) and Firebird 4 ( 32 bit) at the same time
Yes, you have to change port in firebird conf for one of your Firebird version
Here my w10 workstation with default FB3 and FB4 possibility.
20 hours ago, Blavatsky said:I wish to transfer /batchmove 82000 entries from source Paradox 7 database table to target Firebird database,
Very easy with FDBatchmove, but take care of the capacities of Firebird and optimize your table structure
-
20 hours ago, Blavatsky said:Have you got a DEMO PROJECT for this to see the code / properties data?
No, no demo project, it's very easy to reproduce with only the picture as guideline. The connections and query parameters are too depending of your needs
-
Why don't you use a TListView with dynamic appearance and Livebindings ?
-
Hi,
The simplest way (without checking errors)procedure loadbitmapfromblob(abitmap : TBitmap; aBlob : TField); var aStream : TMemoryStream; begin aStream:=TMemoryStream.Create; try TBlobField(aBlob).SaveToStream(aStream); // aStream.Position:=0; aBitmap.LoadFromStream(aStream); finally aStream.Free; end; end;
usage
loadbitmapfromblob(Image1.Bitmap,datamodule2.InsertImg.FieldByName('camarapic'));
But can I suggest this ? (FMX program) or even using Livebindings for "no code"
procedure loadImagefromblob(aImage: TImage; aBlob: TField); begin var aStream: TMemoryStream; begin if aBlob.IsNull then aImage.Visible := False else begin aStream := TMemoryStream.Create; try TBlobField(aBlob).SaveToStream(aStream); try aImage.Bitmap.LoadFromStream(aStream); aImage.Visible:=true; except aImage.Visible := False; end; finally aStream.Free; end; end; end; end;
for VCL use this procedure, not forgetting to declare units Vcl.Imaging.jpeg and Vcl.Imaging.pngimage
procedure TFormVCL.loadImage(aImage: Timage; aField: TField); var aStream : TmemoryStream; begin if aField.IsNull then aImage.Visible:=false else begin aStream:=TmemoryStream.Create; try TBlobField(aField).SaveToStream(aStream); aStream.Position:=0; AImage.Picture.LoadFromStream(aStream); aImage.Visible:=true; finally aStream.Free; end; end; end;
- 1
-
21 hours ago, patcat said:I'm referring to a different project actually:
As you can see, the property "FileName" is empty, and there's still data available in design mode.
Sorry, I found file fishfacts.cds in <RadStudioDemos-Main> \Object Pascal\LiveBindings\common demo found here on GitHub
-
-
16 hours ago, Analyste2023 said:bonjour a tous ,merci a vous de m'avoir aider vos intervention m'en beaucoup aider dans l'avancement de mon projet je suis fier d'etre parmi vous et tres content d'utiliser delphi pour les applications windows
Il existe un très bon forum en français https://www.developpez.net/forums/f15/environnements-developpement/delphi/ (mon pseudo SergioMaster)
-
-
👍 programmerd2k response, and, with firedac, you can simplify his code to :
procedure TForm1.Button1Click(Sender : TObject) begin Salestable.open('',[DateFrom.Date,Dateto.Date]); end;
- 3
-
To respond to question point 8. There are one style for each platform because doing this you reduce size of the app.
In your case, my usage is to create one data module per platform and using IFDEF$ clause on each data module a Stylebook corresponding to platform, all the Stylebook have UseStylemanager=true.
-
-
Using Charset NONE is a regrettable habit ! I still have some database with this default encoding and migration to best encoding is not so easy, no easy tool for this !
Try to use WIN1252 as fdconnexion charset
-
11 hours ago, omnibill said:I found the file LibMySQL.dll was missing from my computer. I downloaded it but there is no change.
You need 32bit version for the IDE
-
Il ne faut pas rêver, j'ai bien sûr conçu un logiciel de ce genre (magasin usine d'un fabricant de chaussures), mais, fournir les sources sans rémunération, comment je me paye la maintenance de Delphi ?
-
-
On 12/8/2022 at 10:43 PM, arend said:if I wanted edit boxes, combo boxes, animations, drag-drop functionality,
Ah, ok, in this case TListBox (or a <Vert,Horz>ScrollBox with Frames) is the need.
When XE4, ListView and dynamic appearance does not exist, as neophyte to styles I wrote my experience in this paper.
I think this chapter will cover your needs
-
-
Quote// here, trying catch the error and stop it (but it doesnt) try qry.Open; except on e : exception do ShowMessage('Cannot open tblBarcodes, error is: ' + e.message); end;
Sure, you can't catch the error if the error is in the upper code !
I think you use a wrong way.
As I understand you have a FDQuery so one way is to use edit/post/delete and so on is to link it to a FDUpdateSQL (fill clauses with expert or by hand)with this method, you can use a "classic"
qry.Insert; // or qry.append qry.FieldByName('col1').asString:='some string'; qry.fieldbyname('col2').as ... qry.post
In a livebinded grid nothing to code
Some remarks :
- when you open a query (or a table) the connection is connected automatically
- use your commands SQL directly on the connection and parameters
con.ExecSQL('insert into tblBarcodes values (:i, :p1,:p2,:p3,:p4)', [6,'120422','Q','abc1','2 120422 Q abc1 desc1']);
- use the INSERT INTO TABLE (<list of column>) VALUES (<list of values>) to avoid auto increment columns
- except if you want a "physical" ordered table don't worry about APPEND
-
7 hours ago, JohnLM said:Progress update.. Success! and Resolved!
I don't think this is a good one solution.
You say it's a FMX project and I assume :
- you use livebindings
- con is your fdconnection
You can do your delete via the FDConnection like this
procedure TForm1.btnDelLastRowClick(Sender: TObject); var lastrowid : integer; begin Query1.last; lastrowid:=Query1.Fieldbyname('IDNO').asInteger; if lastrowid.isnull then exit; // if table is empty con.ExecSQL('delete from tblBarcodes where IDNo=:s',[lastRowValue]); query1.Open(); // or Query1.open('Select * from tblbarcodes'); end;
now this code should show some flickering and have disadvantage to unselect the current row selected 😞 because of Query1.open
1- flickering can be avoided by BeginUpdate .. EndUpdate block
2- there are many ways to memorize current position in the dataset
- using key, memorize in another variable the current idno and usingvar currentid : integer :=Query1.FieldbyName('IDNO').asInteger; // code for deleting Query1.Open(); Query1.Locate('IDNO',currentid,[]);
not recommended if not mono user app
- using recordno
- using FDQuery.GetBookmark and FDQuery.GotoBookmark
-
-
Hi,
You need to give the type of the enumeration, use
Edit1->TextSettings->HorzAlign =TTextAlign.Leading
Edit1.TextSettings.HorzAlign :=TTextAlign.Leading
28 minutes ago, ptlycldy said:I'm new to FMX (VCL is easier)
It's only some ways to change. I use Delphi from D3 version, my new applications are all FMX, it took me 1-2 years to take the plunge, but now I much prefer FMX
- 1
-
-
23 hours ago, Fr0sT.Brutal said:AFAIK parameters couldn't be used inside clauses like LIKE
Depends of SGBD I think, but if not it's possible to, use Firedac macros
21 hours ago, limelect said:the zip is in this communication.
1- This zip contains a SQLite database not a MySQL one as indicated first !
2- The database contains a really poor lines for testing ! And nothing to do with directories
Suggestion for Button2.OnClick
uses System.IoUtils; procedure TForm1.Button2Click(Sender: TObject); var FileListe : TArray<String>; i: integer; begin FileListe:=TDirectory.GetFiles(Edit1.Text); for var s: String in FileListe do i:=i+FDQuery1.ExecSQL('INSERT INTO Files(maindirectory) Values (:s)',[S]); Showmessage(i.ToString+' records added'); end;
Suggestion for Query
procedure TForm1.Button1Click(Sender: TObject); begin FDQuery1.Close; FDQuery1.SQL.Text:='SELECT Maindirectory from files WHERE Maindirectory LIKE &S'; FDQuery1.MacroByName('S').AsRaw:=Quotedstr(Edit1.Text+'%'); FDQuery1.Open; end;
As you can see, this also include ability to use macro char % in the like clause valueso for MySQL INSTR function, you can set Edit1.Text to '%AEnvoyer'
TAKE CARE of SQL Injection with macro usage
22 hours ago, haentschman said:...it works
Ah, yes 👍
so Button2.Onclick can be wrote on different waysprocedure TForm1.Button1Click(Sender: TObject); begin // FDQuery1.Close; // By Macro Need FDQuery1.Close and FDQuery1.Open // FDQuery1.SQL.Text:='SELECT Maindirectory from files WHERE Maindirectory LIKE &S'; // FDQuery1.MacroByName('S').AsRaw:=Quotedstr(Edit1.Text+'%'); // By Parameter Need FDQuery1.Close and FDQuery1.Open // FDQuery1.SQL.Text:='SELECT Maindirectory from files WHERE Maindirectory LIKE :p'; // FDQuery1.ParamByName('P').AsString:=Edit1.Text+'%'; // FDQuery1.Open; // By Parameter No Need of FDQuery1.Close and FDQuery1.Open, my preference FDQuery1.Open('SELECT Maindirectory from files WHERE Maindirectory LIKE :p', [Edit1.Text+'%']) ; end;
- 1
-
55 minutes ago, BennieC said:Even struggled through the French way of doing it
56 minutes ago, BennieC said:I do however have a problem with the flowlayout when anchored
When I use ScrollBox and Frames, I never use anchors, preferring to calculate positions of each frame.
Why ? I remember a video of a Brazilian guy demonstrating that this way was minus time-consuming
get idDrink out of database , based on what is clicked in listbox
in Databases
Posted
First question : Is this supposed to be a FMX or a VCL program ?
If FMX you can write this app with "no code" (except itemclick to change from list to view and reverse) using Livebindings
Here a french tuturial I wrote (2018)