1

(22 replies, posted in Russian)

Dimitry,

Just to let you know many of us would surely buy your future program for web applications.
MVD helped many of us acheive so much. We will be always obliged to you and will be looking forward to any future projects you may have.

Best regards
George

2

(8 replies, posted in General)

Hi

The email test.zip file does not contain any code! Have you found a solution to send emails under windows 10? Can someone post a project that works?

Thank you
George

3

(2 replies, posted in Script)

Ok i managed to amke this work.

I have a table grid that displays info for parts in my wharehouse.
When a user clicks on a row on the grid pictures of the part are downloaded from my web site and they are displayed in 4 image components on a form.

This is the code I used:  (sorry some parts are in greek)

procedure Form1_TableGrid1_OnCellClick (Sender: TObject; ACol, ARow: Integer);
var
url,image_name :string  ;   // για την αποθηκευση των url της τοποθεσιας εως 4 φωτογραφιών ανα προιόν (αν υπάρχουν τόσες)
mikosPinakaUrls :integer;          // αποθηκεύει την θέση που βρίσκεται το διαχωριστικό (;) στο path των φωτογραφιών
urls: array of string;
localImageFileName : array of string;
metritisFor:integer;
ThePicture: TComponent;
begin


gridRowSelected:=form1.TableGrid1.SelectedRow;

url:=form1.TableGrid1.Cells[40,gridRowSelected];           //παιρνω το αρχικο path των φωτογραφιών με όλες τις φωτογαρφίες
urls:=SplitString(url,';');                                //σπαω και αποθηκευω το αρχικο path στα επιμέρους path των γωτογραφιών και τα αποθηκεύω σε πίνακα
mikosPinakaUrls:=length(urls);                             //βρίκσω το μήκος του πίνακα
setlength(localImageFileName,mikosPinakaUrls);

for metritisFor:=0 to  mikosPinakaUrls - 1  do             //τρεχω λουπ τόσες φορές όσο και το μήκος του πίνακα για να φορτώσω τις φωτό
begin

    if metritisFor < 4 then                                     //για να φορτώσω μόνο 4 φωτο. αν υπάρχουν παραπάνω τις αγνοώ.
        begin
        urls[metritisFor]:=ReplaceStr(urls[metritisFor],'https','http');
        HTTPGetFile(urls[metritisFor], ExtractFilePath(Application.ExeName) + 'image'+ inttostr(metritisFor) +'.jpg', True);
        localImageFileName[metritisFor]:=ExtractFilePath(Application.ExeName) + 'image'+ inttostr(metritisFor) +'.jpg';
        ThePicture := form1.FindComponent('Image'+IntToStr(metritisFor+1));
        Timage(ThePicture).Picture.LoadFromFile(localImageFileName[metritisFor]);

        end;


end;

end;

4

(2 replies, posted in Script)

I managed to get the HTTpget to work by installing the latest dll files openssl-1.0.2q-i386-win32.zip that I found online in the root folder of my application.

So the question is if I can directly assign the jpg picture I get using the HTTPget request directly to the image object on the form without saving the image to my hdd before. Is this feasable?

Thank you

5

(2 replies, posted in Script)

Hi

I have an image component placed on a form. The image component is named Image1.

I want to load a picture in this image component from the web.

The path for this picture for example is this: https://www.usedparts.gr/img/p/2/1/3/5/3/21353.jpg

How can I accomplish this. I am trying to use HTTPget but I am not succesfull.

Thank you
George

I think I understand now.
The data that is stored in the sqlite database in the field named 'Ημερομηνίαπροσθήκης' are just text strings. They are not dates in a date field. They are text in a string field. That is why only the '=' operator works.

I will try to figure this out.
Many thanks for your precious help.

I tried your solution but I do not get any results.

The data in the sqlite database have been imported from a csv file.
Maybe I have to convert them to the format you mentioned above.

Please take a look at the attached file. It shows the data in the database.

I am using sqlite.

In the above example the string variable dateSearchString contains a value like this: 21/11/2014 6:09:41 μμ

How can I use the date() function in the sql satetement mentioned in the first post. Can you write an example?

The date values in the sqlite database table have the same format like this 21/11/2014 6:09:41 μμ

Thank you

I could also send the project to you via wetransfer.

You could post the answer on the forum.

Thank you

As can be seen I get a result when I use the '=' operator.
The results are displayed in the last word page.
If I change the operator to '<' it does not work correctly.

Thank you again.

Unfortunately the project is too big to upload. I can upload some pictures in a word file.

Under the grid there is a field that I can input a date and next to it is a button to run the query to display all records that their storage date  is older than
the date selected.

Thank you

Hi

I have an sqlite table that contains a date field with values like : '22/11/2014 2:16:37 μμ'       (μμ stands for pm in greek)

I have a display grid that shows all the records from this table.

I want to be able to select a date period in months e.g. 24 and create an sql search statement that will display all records whose date is less than 24 months from now.

The table contains products in a warehouse  and the date field corresponds to the product's storage date. I want to find out how many products are older that X days in storage from now.

For example: Form1.Tablegrid1.dbSQL:='SELECT * FROM "'+product_table+'" WHERE "Ημερομηνίαπροσθήκης" < "'+dateSearchString+'" ORDER BY "Feature:Μάρκα","Feature:Μοντέλο","Feature:;Έτος","Feature:ΕίδοςΑνταλλακτικού"';

This query works only for the '=' operator. When I use '>' or'<' it does not work correctly and returns wrong results.

Thank you

14

(4 replies, posted in Reports)

Yes it works this way.

Thank you very much

Regards
George

15

(4 replies, posted in Reports)

Thank you so much for your help. I will try it out.

Hi to all,

I have a grid that displays the data from an attached database.
On the same form that the grid resides I also have some drop down boxes to select values to build queries on the displayed data. Everything works of and the data are filtered and displayed on the grid based on the drop down selections.

Now this is the problem that I have:

I wish to create a report on the displayed data (which belong to an attached database).
I have build a button that is setup as an SQL report.
How do I setup the sql query so that I can pass variable data to it and get results from an attached database?

for example: I have a variable names 'make' where I store the name of the make of the car that I want to get data for from the attached table.
The attached table has a name 'products' and the attached database has a name of 'Test'.

How would the sql query be setup?

for example :  SELECT * FROM "PRODUCTS" WHERE "Feature:Μάρκα"= '+make+'  ORDER BY "Feature:ΕίδοςΑνταλλακτικού" AND "Feature:Θέσηανταλλακτικού"

What am I doing wrong?

Thank you

17

(3 replies, posted in Script)

Thank you,

That is the way I implemeted it also. I was just wondering if it could be done in another way.

Regards
George

18

(3 replies, posted in Script)

Also is there a way  with a scipt to select a particular printer for the printout;

19

(3 replies, posted in Script)

Hi

I have a richedit field on a form and a button. I want to press the button and print the content of the richedit field.
The richedit field has a print button but I want to use an external button on my form which is bigger in size.
How can I accomplish this with a script?

Thank you

20

(3 replies, posted in Script)

Thank you.

Both the solutions are good for what I am doing.
Thank you again for answering so fast.

Best regards
George

21

(3 replies, posted in Script)

Hi

I am using an Update sql statement and wish to capture a return value if the update was sucesufull or how many lines were updated.

I am using a script like this : reply:=sqlexecute('UPDATE EXAMPLE SET  NAME = "11333311" WHERE id = "3"');

The update is sucesfull in the table but the reply variable is always empty or zero.

How can I get a reply about the update process?

Thank you
George

22

(4 replies, posted in Script)

Back again.

I managed to do it based on Drivesofts previous post on another thread. It is the same as the one proposed by sibprogsistem but it is formulated as a stand alone procedure.

procedure SaveFileToDatabase (Tablename, Fieldname, Filename: string; id: integer);
var
    sSQL: string;
    sFileName: string;
    sFieldName: string;

    Params: TParams;
    MemoryStream: TMemoryStream;
    Param: TParam;
begin
    sSQL := 'UPDATE '+Tablename+' SET ' +Fieldname+'= :'+Fieldname+', '+Fieldname+'_filename="'+ExtractFileName(Filename)+'" WHERE id='+IntToStr(id);
    Params := TParams.Create(nil);


    // BLOB
    MemoryStream := TMemoryStream.Create;
    MemoryStream.LoadFromFile(Filename); // load file to memory
    MemoryStream.Position := 0;
    Params.CreateParam(ftBlob, Fieldname, ptInput).LoadFromStream(MemoryStream, 15);  // 15 ftBlob (TBlobType)

    Form1.SQLConnection.Execute(sSQL, Params);

    MemoryStream.Free;
    Params.Free;
end;

Thank you for your help.
Regrads
George

23

(4 replies, posted in Script)

Unfortunately I did not manage to make it work.

It should be simple but I am not a professional programmer.

I looked at your code and searched online also but I could not make it work.

The question is simple. I have a table with 4 fields. One of them is for storing an image in BLOB format.

I have all the nessacery data to insert a new table entry but I do not know how to formulate the sql command.

In the attached image you can see the 4 fields.

id                             >>> id of record
Picture                     >>> this is where the BLOB picture must be stored
Picture_filename     >>> the path of the stored picture
id_Vehicles              >>> the id of a connected record in another table

Can anyone help me?

Thank you
George

24

(4 replies, posted in Script)

Thank you for your reply.

I will try it over the next days and report back.

Regards
George

25

(4 replies, posted in Script)

I would appreciate it if someone could help me solve the following problem:

I have a table with 2 fields. One is an image field and the other is it's name.
In the first field I want to store the image in blob format and in the second it's name.

How can I do it with a script? I cannot find out how to store the image as blob in the database.

Thank you
George