HELP con SQL
Publicado por Luis Ponce (119 intervenciones) el 20/08/2007 23:27:49
Hola amigos del foro, tengo un incoveniente al acceder a una base de datos en SQL, utilizo el FW 24, linkeo con BLINKER 7.0, y estas lineas las copie del foro, pero no funciona, alguien podria ayudarme ??
// FiveWin ODBC support test with SQL SERVER
// Direct use with no RDD
// Very important: You must set stacksize to 17500 at the LNK file!
#include "FiveWin.ch"
#include "sql.ch"
//----------------------------------------------------------------//
function Main()
Local oOdbc, oDbf, oQuery
local aData := {}
local aTablas := {}
Local nFor
SET 3D LOOK ON
oOdbc := TOdbc():New( "INTELSOFT","sa","" )
If !oOdbc:lSuccess
oOdbc:ShowErrorList("ODBC session not successfully initialized, aborting...")
oOdbc:End()
return nil
* ELSE
* MSGINFO("SESION INICIADA")
* aTablas:=oOdbc:GetTables()
* MsgList(aTablas)
Endif
// Abrimos la tabla directamente
oQuery:=TDbOdbc():New(oODbc)
oQuery:Execute("select * from tperdat")
MsgInfo( "here" )
if oOdbc:IsError()
oOdbc:ShowErrorList()
oOdbc:aErrors := {}
oDbf:End()
return nil
endif
oDbf:Gotop()
Do While !oDbf:Eof()
Aadd(aData, oDbf:FieldGet(1))
oDbf:Skip()
Enddo
MsgArray(aData, "Fields values " + oDbf:FieldName(1))
oDbf:End()
oOdbc:End()
return nil
FUNCTION MsgArray( aArray, cMsg )
LOCAL cText := ""
DEFAULT cMsg := ""
Aeval(aArray, {|v| cText += cValToChar(v)+CRLF})
MsgInfo(cText, cMsg)
RETURN NIL
De ante mano les agradezco
Att.
Luis Ponce
// FiveWin ODBC support test with SQL SERVER
// Direct use with no RDD
// Very important: You must set stacksize to 17500 at the LNK file!
#include "FiveWin.ch"
#include "sql.ch"
//----------------------------------------------------------------//
function Main()
Local oOdbc, oDbf, oQuery
local aData := {}
local aTablas := {}
Local nFor
SET 3D LOOK ON
oOdbc := TOdbc():New( "INTELSOFT","sa","" )
If !oOdbc:lSuccess
oOdbc:ShowErrorList("ODBC session not successfully initialized, aborting...")
oOdbc:End()
return nil
* ELSE
* MSGINFO("SESION INICIADA")
* aTablas:=oOdbc:GetTables()
* MsgList(aTablas)
Endif
// Abrimos la tabla directamente
oQuery:=TDbOdbc():New(oODbc)
oQuery:Execute("select * from tperdat")
MsgInfo( "here" )
if oOdbc:IsError()
oOdbc:ShowErrorList()
oOdbc:aErrors := {}
oDbf:End()
return nil
endif
oDbf:Gotop()
Do While !oDbf:Eof()
Aadd(aData, oDbf:FieldGet(1))
oDbf:Skip()
Enddo
MsgArray(aData, "Fields values " + oDbf:FieldName(1))
oDbf:End()
oOdbc:End()
return nil
FUNCTION MsgArray( aArray, cMsg )
LOCAL cText := ""
DEFAULT cMsg := ""
Aeval(aArray, {|v| cText += cValToChar(v)+CRLF})
MsgInfo(cText, cMsg)
RETURN NIL
De ante mano les agradezco
Att.
Luis Ponce
Valora esta pregunta


0