Page 4 of 4

Re: DBF to SQL script tool

PostPosted: Tue Aug 05, 2014 12:41 pm
by nageswaragunupudi
We can and we should create different databases on the server for different projects/purposes. On some servers like MSSql, they are referred to as Catalogs. Purpose is the same. You can consider them as folders on our disk.

You can either create them with the help of tools provided at the time of installation or through program:
oCn:Execute( "CREATE DATABASE FWH" ) // here FWH is the database we are creating.

Then while connecting you can directly connect to FWH as default database/catalog.
That is what is the cInitCat is meant for.

Re: DBF to SQL script tool

PostPosted: Wed Aug 06, 2014 8:08 am
by Horizon
Hi Mr. Rao,

I understand. but how can I find out FWH is created or not created. After than I can create database

I also use MySql.

Thanks.

Re: DBF to SQL script tool

PostPosted: Wed Aug 06, 2014 8:55 am
by Marc Vanzegbroeck
Hi,

You can use
Code: Select all  Expand view
oCn:Execute( "CREATE DATABASE IF NOT EXISTS FWH" )


Then it will be only created when it doesn't exist.

Re: DBF to SQL script tool

PostPosted: Wed Aug 06, 2014 9:14 am
by Horizon
Marc Vanzegbroeck wrote:Hi,

You can use
Code: Select all  Expand view
oCn:Execute( "CREATE DATABASE IF NOT EXISTS FWH" )


Then it will be only created when it doesn't exist.


Thank you Marc. I will try it soon.

Re: DBF to SQL script tool

PostPosted: Wed Aug 06, 2014 8:15 pm
by avista
I understand. but how can I find out FWH is created or not created. After than I can create database


Why not something like this

Code: Select all  Expand view

TRY
 oCn:Execute( "CREATE DATABASE FWH" )
 CATCH
 MsgInfo("Error while creating database FWH")
END TRY
 

Re: DBF to SQL script tool

PostPosted: Wed Aug 06, 2014 8:22 pm
by cnavarro
Horizon wrote:Hi Mr. Rao,

I understand. but how can I find out FWH is created or not created. After than I can create database

I also use MySql.

Thanks.


Use the FW_AdoTableExists ( cTable, oCn ) function to see if the table was created (ADOFUNCS,PRG)