Page 1 of 3
Close ADO-connection
Posted: Sun Jul 14, 2013 8:51 pm
by Marc Vanzegbroeck
Hi,
I allways use in the beginning of my program
Code: Select all | Expand
oSQL:=CreateObject("ADODB.Connection")
oSQL:ConnectionString:=ADO_SQL_Connectionstring
oSQL:Open()
...
...
and at the end
and that is working very nice.
In a particual program I want to delete the SQLite-database and do
but the ferase() this returns an error -1
This mean that the file is not closed
I now if a only return recordsets, I don't need to open the file like that, but I need to execute some SQL-commands (like creating tables, and other commands)
How can I close the connection completely with ADO?
Thanks
Re: Close ADO-connection
Posted: Sun Jul 14, 2013 9:38 pm
by Enrico Maria Giordano
Marc,
This is not needed.
Marc Vanzegbroeck wrote:How can I close the connection completely with ADO?
Should be enough. It might be a timing issue. Try to insert a delay between close() and ferase().
EMG
Re: Close ADO-connection
Posted: Sun Jul 14, 2013 10:36 pm
by Colin Haig
Hi Marc
ferase requires the full path of the filename it may not be a sql issue.
Cheers
Colin
Re: Close ADO-connection
Posted: Mon Jul 15, 2013 4:24 am
by nageswaragunupudi
I too confirm the problem.
I could not find a solution yet.
Re: Close ADO-connection
Posted: Mon Jul 15, 2013 5:26 am
by Marc Vanzegbroeck
Colin Haig wrote:Hi Marc
ferase requires the full path of the filename it may not be a sql issue.
Cheers
Colin
Colin,
This is not the problem, because it's working if I don't open the file before.
Re: Close ADO-connection
Posted: Mon Jul 15, 2013 5:40 am
by Marc Vanzegbroeck
Enrico Maria Giordano wrote:Should be enough. It might be a timing issue. Try to insert a delay between close() and ferase().
EMG
Enrico,
A delay between close() and ferase() don't work

I even tested it with 10 seconds delay...
Re: Close ADO-connection
Posted: Mon Jul 15, 2013 6:34 am
by Enrico Maria Giordano
Marc,
Marc Vanzegbroeck wrote:Enrico Maria Giordano wrote:Should be enough. It might be a timing issue. Try to insert a delay between close() and ferase().
EMG
Enrico,
A delay between close() and ferase() don't work

I even tested it with 10 seconds delay...
What did you use for the delay?
EMG
Re: Close ADO-connection
Posted: Mon Jul 15, 2013 7:08 am
by Marc Vanzegbroeck
Enrico Maria Giordano wrote:What did you use for the delay?
EMG
delay(100)
Re: Close ADO-connection
Posted: Mon Jul 15, 2013 7:51 am
by Enrico Maria Giordano
Marc,
Marc Vanzegbroeck wrote:Enrico Maria Giordano wrote:What did you use for the delay?
EMG
delay(100)
Try with SysWait().
EMG
Re: Close ADO-connection
Posted: Mon Jul 15, 2013 9:43 am
by nageswaragunupudi
Thanks to EMG
SysWait(100) worked for me.
Re: Close ADO-connection
Posted: Mon Jul 15, 2013 9:59 am
by Marc Vanzegbroeck
nageswaragunupudi wrote:Thanks to EMG
SysWait(100) worked for me.
Also for me

Re: Close ADO-connection
Posted: Mon Jul 15, 2013 10:36 am
by Enrico Maria Giordano
NageswaraRao and Marc,
Great!

EMG
Re: Close ADO-connection
Posted: Mon Jul 15, 2013 10:55 am
by Antonio Linares
very good!

Re: Close ADO-connection
Posted: Mon Jul 15, 2013 1:46 pm
by James Bott
I wonder about other users having the database open thus preventing deletion. Is there a way to tell? Or, perhaps this is a temp file only created and used by one user?
Re: Close ADO-connection
Posted: Mon Jul 15, 2013 1:53 pm
by Marc Vanzegbroeck
James Bott wrote:I wonder about other users having the database open thus preventing deletion. Is there a way to tell? Or, perhaps this is a temp file only created and used by one user?
I only use SQLite-database on stand-alone programs.
For network-versions I use MySQL. There I don't delete the database-file. Normaly I don't delete any database, but in this paricular program I want the user to be able to delete the SQLite-database, and create an other one...