Xavi
cSQLQuery := "SELECT * FROM DETXMESH WHERE " + ;/*-----------------------------------------------------------------------------------------------*/
FUNCTION ADSRunSQL( cAlias, cSqlQuery, aParameters, hConnection )
/*-----------------------------------------------------------------------------------------------*/
LOCAL nItem, xParameter, lSqlCreate, lSqlQuery, nError, cError,
lSqlOK
lSqlQuery := .F.
lSqlCreate:= .F.
lSqlOK := .F.
cError := ""
nItem := 0
IF HB_IsNil(hConnection)
hConnection:= AdsConnection()
ENDIF
IF !Empty( cSqlQuery )
IF Select( cAlias ) > 0
( cAlias )->( DBCloseArea() )
ENDIF
DBSelectArea( 0 )
cSqlQuery := StrTran( cSqlQuery, ";", "" )
lSqlCreate:= AdsCreateSqlStatement( cAlias, 3, hConnection )
IF ! lSqlCreate
nError:= AdsGetLastError(@cError)
MsgStop( "Error AdsExecuteSqlDirect( cSql )" +
HB_OsNewLine() + ;
"Error:" + AllTrim(Str(nError)) + HB_OsNewLine()
+ ;
cError + HB_OsNewLine() + HB_OsNewLine() +
cSqlQuery + HB_OsNewLine() + cAlias, ;
"ERROR SCRIPT DE ADVANTAGE..." )
ELSE
IF !HB_IsNil( aParameters ) .and. HB_IsArray( aParameters
)
FOR EACH xParameter IN aParameters
nItem := xParameter:__EnumIndex()
cSqlQuery:= StrTran( cSqlQuery, "%" + AllTrim( Str(
nItem ) ), Var2Str( xParameter ) )
NEXT
ENDIF
lSqlQuery:= ADSExecuteSQLDirect( cSqlQuery )
IF !lSqlQuery
nError:= AdsGetLastError(@cError)
MsgStop( cError + HB_OsNewLine() + cSqlQuery +
HB_OsNewLine() + cAlias, ;
'ERROR SCRIPT DE ADVANTAGE...' )
ELSE
lSqlOK:= .T.
DBGoTop()
ENDIF
ENDIF
ENDIF
RETURN lSqlOK
Hi,--
I've just started with harbour because I need to make a program for my company. They gave me a .dbf file and they want to make queries to this database without using odbc drivers, only the ADS(Advantage Database). How can I edit this database File, doing SQL queries?
I'm using Fivewin with Harbour and Borland 5.5 Compiler.
If I can do it with harbour without Fivewin better.
I'tried this code but it doesn't work:
#include "FiveWin.ch"
#include "ads.ch"
REQUEST _ADS
function Main()
rddRegister( "ADS", 1 )
rddsetdefault( "ADS" )
SET SERVER LOCAL
SET FILETYPE TO CDX
USE Clientes // Open any DBF
OrdSetFocus("DIRECCION") // Second Tag on Clientes.cdx
Gotop()
Browse() // Quick browse!!!
USE
return nil
Thanks!!
--
You received this message because you are subscribed to the Google
Groups "Harbour Users" group.
Unsubscribe: harbour-user...@googlegroups.com
Web: http://groups.google.com/group/harbour-users
---
You received this message because you are subscribed to the Google Groups "Harbour Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to harbour-user...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.