1

(5 replies, posted in Script)

You might want to look at this post to understand the loop you are trying to use: https://myvisualdatabase.com/forum/view … hp?id=8920

2

(5 replies, posted in Russian)

The ambiguous "id" error comes from your script where the id is not defined (which table.id?)

Новичок wrote:

Подскажите пожалуйста, вычисляемые поля работают в MySQL или в них запрос немного отличается в отличии от SQLlite


Yes calculated fields are working when connected to MySQL, you just have to adapt the SQL Query to match MySQL syntax if an error occurs. The calculated fields are actually not stored in the database, they are written in plain text in the tables.ini file.

For date calculation, a quick search on internet like here : https://dev.mysql.com/doc/mysql-tutoria … tions.html

Boolean values are stored as 1 or 0 in the database, where do your valueasbooleanxxx come from?

5

(4 replies, posted in Script)

You can also use this form for the Sql Query with sqlite:

 SQLQuery('select substr('JanFebMarAprMayJunJulAugSepOctNovDec', 1 + 3*strftime('%m', date), -3) AS Lab FROM bar_data ORDER BY date DESC', Results)

;

6

(4 replies, posted in Script)

You mean getting the names of the month on the X axle  instead of the 1 to 12 ?

7

(13 replies, posted in General)

pavlenko.vladimir.v wrote:

Он должен вернуться, просто он немного перегорел. Вполне возможно, что именно сейчас он создает новый конструктор


That would be awesome!!

8

(4 replies, posted in General)

k245 wrote:

This happens if you open other people's projects. Open any form and edit anything. This will signal the recompilation of the forms file that stores the license information. This is a feature of this version - to recompile you need to edit something on the project form.

Thanks, that was it, I did not know about this feature and I was actually just opening a project straight from the forum without modifying anything!!

9

(13 replies, posted in General)

sparrow wrote:

But overall the program is working.

Which version of MVD are you using, I did not modify the project, I just want first to see how it works and it does not even start, it trows away the access violation error.

10

(13 replies, posted in General)

Hi,

As I am interested in charting data with MVD, I had a try at the DIAB fixed project but when compiling with MVD 6.5, I get an Access violation at address 00E3CEF0 in module "Diabetes.exe".

Script position 303:8 that is:   

 If Form1.CheckBox1.Checked then
       ChartLine.View3D := True;   

Did you get it working Jean?

11

(4 replies, posted in General)

Actually, it compiles but it is the generated .exe that throws the error.

12

(4 replies, posted in General)

Hi all,

I do have a lifetime license and even though the "About" displays that MVD is registered to my name, I cannot compile anymore with an alert telling me that the trial period has expired. Anyone using the 6.61 beta had this problem too? How to get it to work again?

https://myvisualdatabase.com/forum/misc.php?action=pun_attachment&item=10333

13

(2 replies, posted in SQL queries)

Please keep ids as integer type in the database as that is what it indeed is especially for auto increment. Sometimes, in some querys you might need to transform an integer to string and vice versa which can be accomplished by using strtoint(your field here) or inttostr(your field here). That is especially true with sqlite when comparing data in the same query that must match a certain type.

What would help is to have the real error message as « the code does not work » is vague. To help you further, when a sql error is produced in MVD you can display the query to see where the error is.

14

(5 replies, posted in General)

The data values in your example is not really helping to get a hold on what is what. Could you send a project with realistic data?

As far as I can understand it with the elements above is that you need to count how many trees grouped by kinds and concat that for #1 and sum the count of each type for #2.

Am I right?

What you count is what is in the database, not what is in grid from another form.

15

(2 replies, posted in General)

Does anyone know the name of this form? All I know is that the password is stored in the registry when "save password" is checked

What would be great is to have the login form with a "Mysql connection" tab or folding connection box. Or using OLE ODBC!!

16

(2 replies, posted in General)

Hi,

thanks Sparrow, there is just a little bug: when performing "serial" imports ( multiple imports one csv at a time) without closing the import form, once the check box "Column name as first row" has been ticked and one import completed, if you open another csv file and leave the checkbox ticked, the first row does not display the column names when ticked out! The key is to untick "Column name as first row" before opening another csv file.

17

(2 replies, posted in General)

Hi all,

it looks like the MVD internal import module does not work with MySQL, I always get the error : import is not configured correctly. Even on very simple CSV with 3 rows, 2 columns and no foreign key in the table.

Any insight?

18

(2 replies, posted in General)

Hi all, is there a way to hide the connect form that pops up every time I run an app connected to a MySQL/MariaDB database?

If yes, is it possible to call it again in case of any change in the connection settings?

What I want to achieve is to hide the Mysql connect form if it already has been filled up and add a button that could pop it open back.

I am now testing with MySQL community edition 8 and it does not accept neither 0 or 0000-00-00 as a default value if null for a date column. According to the documentation, the minimum date should be 1000-01-01.

This is just an information in case of anyone would need it.

20

(4 replies, posted in General)

It is not a bug, it is the very intended purpose of the option cascade delete!! Deleting data linked with a relationship (foreign key) could lead to orphan entries.

If you want to delete data in a parent table while keeping the data from children tables, do not use delete cascade.

https://www.databasestar.com/on-delete-cascade/
https://www.sqlite.org/foreignkeys.html
https://www.sqlitetutorial.net/sqlite-foreign-key/

21

(9 replies, posted in General)

Duplicate records is against the main purpose of a database, you should not have duplicated data in a database, use relationships.

Alright, I got it covered... this works to insert data from MVD to SQL Server:

procedure PROCEDURE_NAME_Button1_OnClick (Sender: string; var Cancel: boolean);
 var
  Conn : Variant;
  db_settings,Col1,Col2 : String;
begin

  // ***  create database objects ****
   Conn :=createoleobject('ADODB.Connection') ;


   //*** set database connection parameters ***
  db_settings:='Provider=SQLOLEDB;Server=********;Database=********;UID=********;PWD=*******************;

  //*** Open connection to database ***
  Conn.Open(db_settings);

  //*** Insert data into SQLServer Database ***
  // Format of VALUES() ==> if source field contains only numbers: ‘+<name_of_field.txt>+’   if source fields contains varchar ==> ‘’’+<name_of_field.txt>+’’’   (triple single quotes)
  // One Conn.Execute() per insert.


Conn.Execute('INSERT INTO [TABLE_NAME] (Col1,Col2) VALUES ('+FORM_NAME. FIELD_NAME1.Text+','''+FORM_NAME. FIELD_NAME_2.Text+''')');  //example using fields as datasource
//Conn.Execute('INSERT INTO [TABLE_NAME] (Col1,Col2) VALUES (111,’’VARCHAR_TEXT’’)’); //example using direct data (double single quotes only for varchar text)
     //Always close connection after each transaction
     Conn.Close;
end;

I see a lot of examples to read data from MSSQL SERVER but none on INSERTS, did anyone ever tried to insert data from MVD to MSSQL SERVER?

@Sparrow

Yes it does but then, if you set a date column not null, you must set a default value and the default value 'now' that works in SQLite does is not accepted by MysQL/MariaDB, there is an error and the table cannot be created,  hence my answer with the correct format above your comment.

Another hiccup when connecting to a fresh database with no tables in MySQL/MariaDB from a MVD project, it tries to create twice the table "_user", throws a duplicate error and creates a useless table "_mvd_roles". This never happens when connecting to an empty database from a compiled project. I tried it multiples times when testing my Delete - Import routine. You can also, as I mentioned before, connect the application to an already filled up database containing the exact structure required with no problem at all.

The subject of this post was really about the default value of a Date column when not null is forced in MySQL.

I am using MariaDB 10.11.2 and I found the default value that works is : "0000-00-00" which makes sense considering that it matches the default date format.