Hi to all,
The manual of Fastreport says that this should work:

var

 Variable: TfrxVariable;

Variable := frxReport1.Variables.Insert(1);
// or alternative    Variable := frxReport1.Variables.add;

Variable.Name := 'My Variable 1';
Variable.Value := 10;

When I try this I get only an Errormessage.
Any other way to add variables to a report, I don't want to have in the database?
Its for cash box reports. The Variables will show the Report start date and Report end date.
Thank you for help.

robinx1578 wrote:

Guyz:

I think i just found the solution to protect the MySQL Database from unauthorized access by reading deeply into the script.dcu and forms.xml
What i did is link the MySQL server login information to the label then embed the forms.xml to exe file. I used another software to embed the forms.xml to exe file. I tried to embed the script.dcu but im having an error since its reside inside the script folder.

Here's the link of the file.. Please take your time to view if this thing really works. Dont worry its nothing in there, txtbox are not even connected to the database. But it shows the message connecting to MySQL Server..

https://drive.google.com/open?id=0Bzbqq … 29ycVh5QlU

Special thanks to Teco049, Ehwagner and mathmatho. Let me know if there still chance to view the MySQL Server login information coz its very important for all of us.

Looks good at first sight.
Which software are you using for linking?
For a full test I recommend to do some statistical test like
- merging two files with known text and seaching for added/changed parts
- Analysing of the changed parts if they are compressed or encrypted
.
What kind of application are you writing? Normal office people have regulary not enough backround to analyse .dcu or forms.xml for getting the Connection information. Do you have some fears about hackers or internal/customer requirements?
.
Depending on this you are looking at the wrong end of the work-chain to create a safe database application because there are still a lot of ways to get the database connection information. But for any recommendation some more information would be helpfull. At this point I would say a interested hacker would need some more time to get the connection information and can do much more to ruin you planning.
.
The connection to the database is not safe for high security applications...

robinx1578 wrote:

Guys:

Ehwagner trick works, at least we can hide the MySQL Information a little bit.
My code goes like this

frmMain.MySQLConnection.Server := frmConnect.label2.Caption;
frmMain.MySQLConnection.Port := StrtoInt(frmConnect.label3.Caption);
frmMain.MySQLConnection.Username := frmConnect.label4.Caption;
frmMain.MySQLConnection.Password := frmConnect.label5.Caption;
frmMain.MySQLConnection.Database := frmConnect.label6.Caption;

I hope in future the script.dcu be embedded in .exe file.

Thanks Ehwagner for sharing your idea..

You can find it still at forms.xml. Together with script.dcu, which shows the labels, you can re-asgin the values.
Working for script kiddies but not if somebody really want to get into the database.

Currently only way is to store the values xor encoded or as hex value. There are some examples at the forum how to do it.

79

(1 replies, posted in Reports)

I am currently planning the design for a new application and need some "brain input" and help with a report.
.
Question comes About reporting and SQL.
.
I have at least two tables. One called   "customer" the other "articles".
.
Now I could do a report like articles purchased from a customer with

select customer.number, customer.name, articles.number, articles.text from customer, articles where articles.customer = customer.number    

.
Or a report like which customers has purchased a specific article with

select customer.number, customer.name, articles.number, articles.text from customer, articles where customer.number = articles.customer    

.
All SQL Selects as source for a report.
.
Now the question is how to setup a report for all customers and all articles, sorted and printed as "Customer -> Articles" or "Articles -> Customer" without restriction to one customer or article. Something like

select customer.number, customer.name, articles.number, articles.text from customer, articles group by customer.number

.
Would this work with MVD or does I need to change the SQL Statement or - worst case - it is not possible as SQL Statement and I must do a manual listing for all Articles/Customers with a script?

Any suggestions and information, please.
Thank you.

80

(4 replies, posted in Script)

Dear Dmitry,
.
Works perfect.
Thank you for your help.
.
I wish, other software vendors would work so effective and helpfull as you.

81

(4 replies, posted in Script)

DriveSoft wrote:

Hello.


I have added function GetFileSize to get file size.
Please download latest beta version:
https://www.dropbox.com/s/xf20ksdbdgj6w … b.zip?dl=0



Also I have attached an example, how to store file to database using script:

Dear Dmitry,
.
Thank you for your help.
.
I have still a little problem.
When I have the file dialog on the same form where I have the table with the stored files, I can not use the store button at the file dialog. It shows no files to store.
I have tried to expand your example with a way to store a file from Database back to Disk by script.
Please take a look at the expanded version. I think that I have missed something or have read the wrong information from Embarcadero about the used functions...
.
Thank you.

82

(4 replies, posted in General)

DriveSoft wrote:

Unfortunately I can't find any API documentation for this printer on official web site..

You can't.
Only pre-registered people/companies can do. Like Gemalto.

In other words: Who is in need to use this equipment need to have own programmer who can use a full featured compiler.

Otherwise they should use cheap consumer equipment with a public available API.

83

(4 replies, posted in Script)

For a project I need to know if I can store a selected file via script into the database or only by action.
.
As attached, the file storage is included in the same page where the project information is stored. The old application, which should be replaced, has worked in the same way and the new application should work like the old.
.
Before storage I need to find out the size for the file to add. Depending on the size the File will be stored inside the database or outside on a file folder.
.
Is there a way to store the file via script to the Database or read out the file from the database to a folder via script?
.
Attached is a sample from the project planning.
.
.
Thanks for helping.
.
.
UPDATE:
Storing without scrip is working, but there is no relation to the main record in the database.... How can this be changed?

84

(4 replies, posted in General)

DriveSoft wrote:

Hello.


I have added calculated fields for that.
Please check it out

Thank you.

85

(4 replies, posted in General)

Hi,
I am currently not at the office, so I have used the free version 1.44 as I have only the company licence and no personal licence.
Table grid is on form1.
It should show for each company how much visitors are registered and how much are on site.
I have used a seach function, but it shows only one line as result.
Any idea how to manage it that it shows like
.
company 1   xx registered    xx on site
company 2   xx registered    xx on site
company 3   xx registered    xx on site
company 4   xx registered    xx on site

86

(4 replies, posted in General)

Hello,
I am trying to fill a TableGrid with a SQL Script. I want to display information from more as one table to the grid.
Something like

Select ID, Date, Company (select id, sum(Badges) from Badgelist) text from Visitors order by Date desc,id desc

I get an Errormessage:

Error message:
only a single result allowed for a SELECT that is part of an expression

I have not yet done an application, only some changings in an existing application.
.
At the forum I have nothing found if it is possible to display in one table grid information from more as one table.
Table 1: List of companies who are visitors
Table 2: List of visitor badges issued to a company.
Table 3: List of visitors on site.
.
Table grid should show:
Record ID   Companyname   issued Badges   Visitors on site
.
EDIT:
.
Correct display should be:
Record ID   Companyname   count(issued Badges)   count(Visitors on site)
.
The last 2 collums should only show the total count, not detailed information.

87

(4 replies, posted in Reports)

Problem solved.

For whatever reason you must use the Name of the first form in you application. Any other form has not the Object frxReport.
.
If you have renamed this form you must use the renamed name.
.
.
Example:
Original formname:
Form1.frxReport.clear
.
Renamed Form1 to ThisIsMyLargeFormNameWithoutSpaces
ThisIsMyLargeFormNameWithoutSpaces.frxReport.clear
.
The sample of ehwagner must be adjusted to whatever name you have renamed your first Window form.

88

(4 replies, posted in Reports)

I have a misunderstanding problem.

I get always a error message "undecleared identifie: 'frxReport'" on the line

Form1.frxReport.Clear;

I have renamed it to

Berichte.frxReport.Clear

Because all Printings are on "Berichte".

Where is the "frxReport" delcared? I have nothing found at the sample script

procedure Form1_Button4_OnClick (Sender: string; var Cancel: boolean);
var
    frxDBDataset1, frxDBDataset2: TfrxDBDataset;
    Results1, Results2: TDataSet;
  begin

    // Data for first dataset
    SQLQuery('SELECT * FROM Settings where id = 1', Results1);

    // Data for second dataset
    SQLQuery('SELECT * FROM Categories' , Results2);

    // create first DataSet
    frxDBDataset1 := TfrxDBDataset.Create(Form1);
    frxDBDataset1.UserName := 'Report1';
    frxDBDataset1.CloseDataSource := True;
    frxDBDataset1.OpenDataSource := True;
    frxDBDataset1.DataSet := Results1;

    // create second DataSet
    frxDBDataset2 := TfrxDBDataset.Create(Form1);
    frxDBDataset2.UserName := 'Report2';
    frxDBDataset2.CloseDataSource := True;
    frxDBDataset2.OpenDataSource := True;
    frxDBDataset2.DataSet := Results2;

    // set up report
    Form1.frxReport.Clear;                                                
    Form1.frxReport.DataSets.Clear;
    Form1.frxReport.DataSets.Add(frxDBDataset1);
    Form1.frxReport.DataSets.Add(frxDBDataset2);


    // DESIGN MODE - comment the following two lines and uncomment the preview mode lines to preview report

    Form1.frxReport.LoadFromFile(ExtractFilePath(Application.ExeName)+'Report\MyReport.fr3');
    Form1.frxReport.DesignReport;


    // PREVIEW MODE - comment the following four lines and uncomment the above design mode lines to design report

    //frxDBDataset1.DataSet.Close;
    //frxDBDataset2.DataSet.Close;
    //Form1.frxReport.LoadFromFile(ExtractFilePath(Application.ExeName)+'Report\MyReport.fr3');
    //Form1.frxReport.ShowReport;


    frxDBDataset1.Free;
    frxDBDataset2.Free;
end;

begin

end.

And there is no button definied as for printing on the forms.

Any Idea what I am missing?

DriveSoft wrote:

I see that you use script for all database operation (Update/Insert), usually there is no need to use script for that, more easy way to use buttons with action "New Record", "Show Record", "Save Record" etc.  I can recommend for you video lessons:
http://myvisualdatabase.com/video_lessons.html



But if you use SQL, some tips:

To store INTEGER values, set property NumbersOnly=True for component kassenbuch.edit4, then you can use script

kassenbuch.edit4.sqlValue

instead

replacestr(kassenbuch.edit4.text,',','.')


to store date

Kassenbuch.DateTimePicker1.sqlDate

instead

formatdatetime('yyyy-mm-dd',Kassenbuch.DateTimePicker1.DateTime)

Dimitry,
Thank you for the information and help.
I was in need to use for insert/update SQL Statements instead of the actions because I haven't found a way to calculate and add the hash value at the same time when I insert or update to the database.
Thank you.

Dimitry,
Thank you for the information. I have do some changings and it works at the moment.
The project is attached. Maybe you find something I can do better.
Project is in german language.
Thank you.

Found some solutions for me and a possible bug.
.
Scripting engine:
After all procedures/functions

begin
  Form1.TableGrid1.dbUpdate;
  Form1.Edit1.Text :=sqlexecute('select sum(income) from accounting');
  Form1.Edit2.Text :=sqlexecute('select sum(expenses) from accounting');

end.

Result: Application crash.

Error Message attached.

Software: MyVisualDatabse 3.2

Hello,
I have some questions, hopefully no problems...
.
Table Grid:
Date are not shown. I have checked the database. The date is stored as dd.mm.yyyy and not as dd.mm.yyyy hh.mm.ss.xxx. I am using sql statements for storing dates like

update entries set date = datetostr(form1.datetimepicker.datetime)

Anything missing here?
.
Float:
I am located in germany. We have no decimal dot we have decimal comma. Our amounts are shown as
1,98
1.234,98
and not
1.98
1,234.98
calculations does not work with sql statements. When I use

select sum(value) from entries 

and I have a lot of values like
1,29; 0,69; 5,63
Only the part before the comma is calculated and the table grid does not show larger amounts, which are written 1.234,98...
Is there any automatic conversation possible to change the , with . and the . with ,
When I use

replacestr('1.234,98', ',' ,'.')

I get 1.234.98 which I can not convert to 1,234.98.
.
Any solutions/ideas?
.
Thank you.
.
Project not attached, because it is written with german dialog text...

93

(5 replies, posted in General)

tcoton wrote:

Updates should be planned carefully in order to whether being able to import the old data into a new structure or keeping the old structure and just add new features with no new tables or column.

When I do a major updates on my databases, I run several tests to make sure that I could export the data from an older version properly and import  them into the new one without data loss. Most of the time it is just on or two reference tables to be updated. The key is to design the database to be modulable with no major impact. It is best to have a lot of small tables rather than one big table with a lot of columns where upgrades would turn into a nightmare.

I am aware about these possible problems and how to design a database structure. Best as a N3.

But the big question is how structure updates are handled by MyVisualDatabase. Can I update the structure and send it to other users or does I need to add an export feature and import feature for others. I can not await that others will use an additonal database browser for exporting, updating and importing datas from an old structure to a new structure.
To include tables for every future usage is a soundable theory, but not possible in all development plans.

So finaly the question seems to be still open about how MyVisualDatabase would handle a structure update and if it is possible to start an application without accessing the database and do a manual structure updates via sqlexecute() before the database would be touched by the application.

94

(5 replies, posted in General)

I have a general update question about the database.
.
Lets have the following situation to make my question understandable.
.
1: You have created an application and give it to others (customers).
2: The others are using the application and enter a lot of data to the database.
3: You make a new version with changed database structure (more tables, more fields, changed fields, etc.).
4: The others are getting the new version and install/copy it over the old version. They keep their old database to keep the data they have entered.
.
The question is now:
.
1: Will the old database be keept unchanged and you (the persion who has created the application) must do all changes with SQL Statements.
2: The database will be updated with all changings.
3: The database will be rewritten and the others can say "goodbye" to their datas. In this case it would be needed to write a database backup as a dump and restore procedure and not as a simple copy of the database file.
.
Any experience for this szenario?
.
Thank you.
.
.
.
P.S. sorry for the dot-lines, but the forum does not accept empty lines I am entering...

95

(4 replies, posted in Reports)

Hello ehwagner,
looks like the part I am looking for.
Thank you.

96

(7 replies, posted in Script)

Here we go.
Remember: It is ony a test application. For real usage there is a lot more of work needed. This way shows only how it could work but not how it could be safe (this is up to your imagination).

97

(7 replies, posted in Script)

REPAIRD.

After fixing some typing errors everything is working as planned.

Thank you.

98

(7 replies, posted in Script)

Hello mathmathou,
Thanks for helping to find the step I have forgotten.

What I want is to update the database with the testresult.
I was hoping that changing the value would directly change the database too and not only the memory.

I was trying to access the "ID" of the record but this has not worked. Following a copy from the original try - with your correction - which was not working:

while not evaluate.Eof do
       begin
          checkmate := strtomd5(evaluate.fieldbyname('valueA').asstring + evaluate.fieldbyname('valueA').asstring);
          recordid := evaluate.fieldbyname('ID').asinteger;

          if (evaluate.fieldbyname('valueC').asstring <> checkmate) then
              begin
                 sqlexecute('update entries set resultB = 1 where id='+recordid);
              end
          else
              begin
                  sqlexecute('update entries set resultB = 0 where id='+recordid);
              end;
           evaluate.Next;
       end;
   evaluate.free;

- Errors are possible because I am at the moment not at work...

The "evaluate.fieldname('ID').asinteger" create an error message but not working result. Maybe something missing here or is it not possible to access the ID field this way?

Finally it should be a test system for checking database records if they have been modified outside the application with a Database Browser.

At the end it would be something like

checkmate := strtomd5(evaluate.fieldbyname('valueA').asstring + evaluate.fieldbyname('valueA').asstring + SecretWord);

Where "SecretWord : string" and stored inside the Application or Database as base64 encoded value.

Is there a Delphi Source about encryption (AES, Blowfish, Twofish, etc.) which can be included in MyVisualDatabase or is there any restriction because it comes from Russia? I would like to encrypt the SecretWord and some Fields more complicated to prevent some "weekend hackers" or "script kiddis" from changing record values.

Thank you.

99

(7 replies, posted in Script)

Sorry, Here it is

100

(7 replies, posted in Script)

Hi,
I have a problem with a little test application where I am testing some basic functions I need in further projects.

Project is attached.

What it should to:
- You enter some values in a table and a hash value is created as a kind of "seal" for these values.
- Later you edit some entries, but the hash will not be updated (as a proof that the record has been changed.
- Later you delete some records. So you have some holes in the IDs.

What are the problem:
- Accessing a fild as "asboolean" creates an error.
- When I click on "Check/Compare" the Application hangs.

Any idea why this happens and is this handling possible?

Tested with MyVisualDatabase 3.1