Hi all. According to the example import export project which does not include the foreign keys of the database,is there a way to include the foreign keys in the project?, so the while database could be export and import in and from a csv file

( PRAGMA foreign_keys = ... ).

I don't understand what  I should do with that command.

teco049 wrote:

You are using databases with references to other tables.


The export is catching the table names from the master table.


For export this is fine, because you can export table contant in any order without side effects - in theory.


In practise you must import records in a database with references between 'Master' and 'Slave' Tables in a strict top-down order.


This means first the origin tables where you later reference to and then the tables with the records who are using the - I like to call it 'Master' tables.


The script has the problem that this master-slave or top-down order with respecting the table references is not taken into account.


So the export from this script can not be imported. You would need to manual delete all references, import the records and then restablish the references. Alternative you need to change the export script from automatic catching the tables to a manual preset. In this preset you have to take into account the top down structure of your database.


Many work.


One of the reasons why I directly change the database structure before the main software starts.


A common problem with databasees who uses table references.


In other words: you have reach the limits of MVD. Without a manual script for the table updates it will be hard to work.


If you will not bear the costs of RAD Studio, take a look into Lazarus-IDE or Pilotlogic Code Typhoon. Both are Free Pascal with is mostly similar to the definition of Delphi 7, but with Unicode by default.


Dimtry should realy update MVD with a internal update process for database update in a running system.



I will take your and domebils  advise for  RAD Studio. I have already Lazarus installed in my PC, but the forms are making my life difficult.

domebil wrote:

Having such complex databases I recommend using Rad Studio

I will give it a look.
Thank's

domebil wrote:

See in the image the table is repeated


But my database is correct with those two related records. (I need them because I call from one table two different Names for customers)
Any idea?

Can you give me an example of what error should I looking for?

I have convert my program to your Import-Export example ,added only the database and not the forms, As you can see it export the database , but when I try to Import it crash and give the error message(FOREIGN KEY CONSTREINT FAILD) after some seconds after some seconds the progress bar finished
This is my software. It is a program that will transfer all the tables and records in another updated program using the Excel (csv) and not copy the database
So try to export the database and then import it.

I get en error when trying to import . The error message is the following FOREIGN KEY CONSTREINT FAILD. Please help how to resolve this to continue???

159

(2 replies, posted in SQL queries)

Help for script,
I have 2 tables related and I want to have a delete cascade option in a record.
I use this script but it faild

sqlexecute( 'Update TABLE tele CONSTRAINT FOREIGN_KEY id_Stoixeia  REFERENCES Stoixeia (ID)  ON DELETE CASCADE');

Thank you

I have add a new column (Boolean type to my project) and I like to set to all the records the Value True
I use the script
sqlexecute('INSERT INTO  WORK (KRYFO) VALUES (0)')
but it insert only in the last record the value

162

(8 replies, posted in General)

Thank you all

163

(8 replies, posted in General)

Yes i know this option in the datsbase. My question is can I do that cascade delete using script ?

164

(8 replies, posted in General)

Is there any way to bypass this message and delete the record????

165

(8 replies, posted in General)

I am wondering if I can just put the following script of a function in a button click and not call the function
   function OnSQLException(Sender: TObject; Msg: string; SQL: string): boolean;
begin
    // exception from button frmStoixeia.Button4
    if Sender = frmDiafora.Button39 then
    begin
        if Pos('FOREIGN KEY constraint failed', Msg)=1 then
        begin
            result := True; // to prevent system message
            MessageBox('Αδύνατη η διαγραφή. Υπάρχουν συνδεόμενα.', 'Error', MB_OK+MB_ICONWARNING);
        end;
    end;

this function is if we get an error message FOREIGN KEY constraint failed', it should stop the procedure and giving us a custom message.
I want that when i press a button to get the result without  running function. What I want is to create an option with the script running or without the script

Hi there, my personal opinion is that my visual database is a great tool to create small projects and especially for someone who don't have the knowledge about SQL like me. Of course for better and more professional projects there are other languages with more tools. I still use my mvbd because I learned Pascal at school and I really love this language. So about the import export program which is a great project I found that the script crashes if I use it in my project and it shows me an error about  foreign key.the error message FOREIGN KEY CONSTREINT FAILD. Because I update my projects from time to time with new ideas so I need a script or a tool that it updates the database with the new columns it's transferring the records to the database. So I will ask again if there is a way to check the table if not exist to add it with the columns (also which include foreign keys) and if there is a table and check if not exists columns and add them (also if the columns are foreign keys).
This moment I use every time I update my project a small program to do that work adding the columns and transferring the records.

167

(2 replies, posted in General)

Thank you

168

(2 replies, posted in General)

Hi, in my small example i like to ask if there is a way to delete record from the tablegrid from the Form1, I get an ERROR MESSAGE  FOREIGN KEY  CONSTRAINT FAILD.
i understand it because there is a retationship between the tables , but if I still want to delete the record how can I do that, without loosing the datas from the other tables

domebil wrote:

try this

Works perfect!!!!! thank you.
So I must convert it for my project.

It's not a good idea, because it export separately all the tables and when importing you must do it again one by one for all the tables and giving the headers manually the name of the columns.
Except if there is another way.





CDB wrote:

Generally speaking, you could export the current database in CSV format and then import into the new database. If the new fields are to the right of the old fields (so to speak), you should be able to just import the records so long as the old field names have not been changed.

The Export and Import function provided in MVD under options should do the trick.

171

(2 replies, posted in General)

I do not see any difference ...

172

(2 replies, posted in General)

hi all,
when i run my program in my pc the screen of the forms are ok but when i run it from other pc's with other screen resolutions how is it possible to get same screen resolutions like my pc every time i run my program ? Any idea???

173

(2 replies, posted in General)

Thank you

Please in english...thank you

I have a project that from time to time I upgrade it, not only the software but also the database with new columns and tables, (with new relations between them). So my question is how can I transfer the existing records from the database to the new, without making the life of my customers difficult.
The only solution that I have is to create a small program all the time I make a change in the database that makes the job. The progress is simply I copy the "old" database in the folder of the program,  that add the new tables and columns and transferring the data's and run the program using Sqlite script (my sqlite script is very poor) . After that I copy and paste the "new" database to the new upgraded software folder.
To avoid all this does anyone know a simply way. Keep in mind that it will be for my customers which they do not have an experience of programming