How to Use SQL commands with ADS?

How to Use SQL commands with ADS?

Postby Armando » Thu Nov 18, 2010 3: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: Select all  Expand view

    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
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: How to Use SQL commands with ADS?

Postby giuliano » Thu Nov 18, 2010 9: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
User avatar
giuliano
 
Posts: 42
Joined: Mon Sep 25, 2006 8:38 am
Location: ITALY

Re: How to Use SQL commands with ADS?

Postby Gale FORd » Thu Nov 18, 2010 2: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.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: How to Use SQL commands with ADS?

Postby Armando » Thu Nov 18, 2010 2: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
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México

Re: How to Use SQL commands with ADS?

Postby Gale FORd » Thu Nov 18, 2010 2: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.
Gale FORd
 
Posts: 663
Joined: Mon Dec 05, 2005 11:22 pm
Location: Houston

Re: How to Use SQL commands with ADS?

Postby Armando » Thu Nov 18, 2010 3: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
User avatar
Armando
 
Posts: 3061
Joined: Fri Oct 07, 2005 8:20 pm
Location: Toluca, México


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot], nageswaragunupudi and 64 guests