Topic: Loss of Copyto when using custom db filename

I have noticed that if I use any name other than sqlite.db for my database file that CopyTo quits working on both DbFile and DbImage.  I can still save the information to the database, however it does not copy the files.  Can anyone else verify this?  Or is this the way that it is suppose to be?

Sonny.

Re: Loss of Copyto when using custom db filename

I guess its just me

Sonny.

Re: Loss of Copyto when using custom db filename

attach your project

Re: Loss of Copyto when using custom db filename

sibprogsistem wrote:

attach your project


Please find the attached project

Post's attachments

Attachment icon CopyTo.zip 581.69 kb, 240 downloads since 2020-05-26 

Sonny.

Re: Loss of Copyto when using custom db filename

попробуйте

Post's attachments

Attachment icon CopyTo.7z 2.79 kb, 232 downloads since 2020-05-26 

Re: Loss of Copyto when using custom db filename

Try this project
maybe help you

Post's attachments

Attachment icon Copy To.rar 873 kb, 247 downloads since 2020-05-26 

Re: Loss of Copyto when using custom db filename

sibprogsistem wrote:

попробуйте

This still doesn't work for me.  I have tried adding the image and file folder to the directory.

Sonny.

Re: Loss of Copyto when using custom db filename

agusecc wrote:

Try this project
maybe help you

Thank you, both for trying.

agusecc, it will work using the filename sqlite.db.  I was trying to use a custom filename for my database.

Sonny.

9 (edited by sibprogsistem 2020-05-26 12:43:03)

Re: Loss of Copyto when using custom db filename

sdhale29 wrote:
agusecc wrote:

Try this project
maybe help you

Thank you, both for trying.

agusecc, it will work using the filename sqlite.db.  I was trying to use a custom filename for my database.

Form1.SQLConnection.Connected := False;
 Form1.SQLConnection.Params.Add('Database=ExtractFilePath (ParamStr (0))+'Program.db');

10 (edited by sdhale29 2020-05-27 02:15:45)

Re: Loss of Copyto when using custom db filename

sibprogsistem wrote:
sdhale29 wrote:
agusecc wrote:

Try this project
maybe help you

Thank you, both for trying.

agusecc, it will work using the filename sqlite.db.  I was trying to use a custom filename for my database.

Form1.SQLConnection.Connected := False;
 Form1.SQLConnection.Params.Add('Database=ExtractFilePath (ParamStr (0))+'Program.db');

My Form1 is renamed to frmMain
I tried the below code and it still doesn't copy the file when saving.

frmMain.SQLConnection.Connected := False;
frmMain.SQLConnection.Params.Add('Database='+ExtractFilePath(ParamStr(0))+'Program.db');
Sonny.

11

Re: Loss of Copyto when using custom db filename

sdHale,

I haven't tried the above code, but it might depend on where you wrote it in the script, for example did you write it in the forms 'onShow ' event or in the body of the script?

You may also have to save the DB name into the Settings.ini as well.

On a clear disk you can seek forever

12 (edited by sdhale29 2020-05-27 06:06:59)

Re: Loss of Copyto when using custom db filename

CDB wrote:

sdHale,

I haven't tried the above code, but it might depend on where you wrote it in the script, for example did you write it in the forms 'onShow ' event or in the body of the script?

You may also have to save the DB name into the Settings.ini as well.

I used the forms Copyto function.  I also tried it in the script Onshow.  Neither worked so I just changed the file back to sqlite.db and it works.

I had the settings file setup correctly because it would write everything to the db.  It just wouldn't copy the file and update the file_filename in the db.

Im really not sure.  I have a pretty complex db with a lot of scripting, but everything works even with the "Program.db" filename except for the CopyTo.

When I change it back to sqlite.db the CopyTo field on the forms works again and so does everything else. 

The above example is just something that I threw together to show that it doesn't work when using a custom db filename.

Sonny.

13 (edited by agusecc 2020-05-27 17:19:34)

Re: Loss of Copyto when using custom db filename

Hi sdhale29

you can rename sqlite.db with name others, after your project finish..
and you can use  link setting from your project  and set your project to new name database..
see my attachment

Post's attachments

Attachment icon sqlite.PNG 21.55 kb, 112 downloads since 2020-05-27 

14 (edited by sdhale29 2020-05-27 18:36:08)

Re: Loss of Copyto when using custom db filename

agusecc wrote:

Hi sdhale29

you can rename sqlite.db with name others, after your project finish..
and you can use  link setting from your project  and set your project to new name database..
see my attachment

Getting it to find, read, and write to the renamed database isn't the problem.  I can set the database filename as you show, and it writes to it fine.  The CopyTo setting on the DBFile and DBImage objects however does not work when doing this.

Sonny.

15 (edited by derek 2020-05-28 09:35:36)

Re: Loss of Copyto when using custom db filename

Hi Sonny,
Please have a look at the attached which is working on my setup (obviously, your full path will depend on where you install it).
Derek.

Post's attachments

Attachment icon CopyTo.zip 528.75 kb, 280 downloads since 2020-05-28 

Re: Loss of Copyto when using custom db filename

derek wrote:

Hi Sonny,
Please have a look at the attached which is working on my setup (obviously, your full path will depend on where you install it).
Derek.

Derek,

The CopyTo is working, however now it isn't renaming the filename after copy.  So now to use this I will have to go into the script and give file and photos a full path I guess for it to rename accrodingly.

I am using (ExtractFilePath(Application.ExeName) in my script, I guess this quits working as well.

Is there not a way to set the program to just output a different filename instead of sqlite.db in the core settings this way we can still use Save the database file in the folder with the application with a different filename?  Dmitry!!!!!!!!!!????????  smile

I haven't been able to get it to work, because I haven't given it a full path.  I have just been typing Progam.db in the field which allows it to read and write to the database, but loses the CopyTo function because it doesn't know the path to copy the files to.  It makes since, but I do not want to limit where it can be installed and I would like to keep it in the directory with the program.


Thank you all for helping with this.

Sonny.