FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour How to Use SQL commands with ADS?
Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
How to Use SQL commands with ADS?
Posted: Thu Nov 18, 2010 03:04 AM
Dear friends:

Some guru of ADS that can provide me a small example of how to execute SQL commands with ADS?
I need some commands like INSERT, DELETE, CREATE etc.

I have tried with this code without success.

Code (fw): Select all Collapse
    ADSPrepareSQL( hStatement,"CREATE TABLE Meses( " +;
                        "Numero Numeric(3,0)," +;
                        "Descripcion Char(10)) IN DATABASE")
    ADSExecuteSql(hStatement)


Thanks and best regards
SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 50
Joined: Mon Sep 25, 2006 08:38 AM
Re: How to Use SQL commands with ADS?
Posted: Thu Nov 18, 2010 09:12 AM

Hi Armando,

Try this:

Select 0
ADSCReateSqlStatement("hStatement",1)
ADSExecuteSQLDirect("CREATE TABLE Meses( " +;
"Numero Numeric(3,0)," +;
"Descripcion Char(10)) IN DATABASE")

Bye.
Giuliano

Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: How to Use SQL commands with ADS?
Posted: Thu Nov 18, 2010 02:22 PM

I noticed that the Advantage Database Architect can generate the SQL code to build a table. Under "Tools"/"Export Table Structure as Code". I am using version 10 and I do not know if that option is available in older versions.

Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: How to Use SQL commands with ADS?
Posted: Thu Nov 18, 2010 02:42 PM

Guiliano:

Thanks so much, your example works fine, thanks again.

Gale:

I'm using version 9.1 and there is that posibility but I want to learn to do that via code, regards.

Best regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero
Posts: 663
Joined: Mon Dec 05, 2005 11:22 PM
Re: How to Use SQL commands with ADS?
Posted: Thu Nov 18, 2010 02:55 PM

No problem. I like to see the code it generates so I can learn how to do it. I can even show you the SQL code to rebuild the data and the structure.

Posts: 3358
Joined: Fri Oct 07, 2005 08:20 PM
Re: How to Use SQL commands with ADS?
Posted: Thu Nov 18, 2010 03:48 PM

Gale:

You are right, I took the code for my example of that part, it's a good idea.

Regards

SOI, s.a. de c.v.
estbucarm@gmail.com
http://www.soisa.mex.tl/
http://sqlcmd.blogspot.com/
Tel. (722) 174 44 45
Carpe diem quam minimum credula postero

Continue the discussion