Página 1 de 1
Error en apertura de archivos
Publicado: Jue Abr 22, 2021 10:36 pm
por Daniel Pechir
Hola a todos
Ya logré conectarme en mi sitio web
Sin embargo no me quiere funcionar el query con el siguiente código:
IF :lConnected
MsgInfo( 'Conectado a '+cDatabase, 'Aviso' )
WITH OBJECT ::oPrueba
:cSelect := "select * from Empresa where Nombre <> ''"
:nCursorType := adOpenDynamic
:nLockType := adLockOptimistic
:cProcess := 'GENERAL'
IF :lOpen
:Close()
ENDIF
IF !:lOpen
:lOpen:= .T.
IF !:lOpen
MsgStop( "ERROR: No es posible abrir el archivo Empresa", "Error de conexion.." )
RETURN NIL
ENDIF
ENDIF
:lReadOnly := .F.
IF :RecCount() > 0
MsgInfo( 'Tengo Datos' )
ENDIF
END
::oGo:lEnabled := .T.
::oGo:SetFocus()
ELSE
MsgAlert( ' No se logró la Conexión ', 'Aviso' )
::oGo:lEnabled := .F.
::oAbort:SetFocus()
ENDIF
Se conecta
Muestra un SHOWDATABASES
Inclusive si se le pide un GetTables las muestra, pero se atota con el query
- img 2.png (17 KiB) Visto 1413 veces
- img 4.png (14.66 KiB) Visto 1413 veces
Re: Error en apertura de archivos
Publicado: Vie Abr 23, 2021 1:02 am
por Daniel Pechir
- img 2.png (17 KiB) Visto 1404 veces
- img 3.png (15.26 KiB) Visto 1404 veces
- img 5.png (18.92 KiB) Visto 1404 veces
Re: Error en apertura de archivos
Publicado: Vie Abr 23, 2021 2:30 am
por Daniel Pechir
Les comparto el código con el que pude abrir una tabla
IF ::oSQLTable1:lOpen
::oSQLTable1:Close()
ENDIF
cDatabasesel := "`" + ::oListbox1:aItems[ ::oListbox1:nIndex ] + "`"
WITH OBJECT ::oMaria
cDatabase := cDatabasesel
cHost := xxxxxxxxxx
cPassword := xxxxxxxxxx
cUser := 'dapesist_daniel'
cServer := cHost
IF ! ::oMaria:Connect()
MsgStop( "NO ES POSIBLE REALIZAR LA CONEXION CON EL SERVIDOR DE DATOS" + Hb_OsNewLine() + ;
"POR FAVOR, REVISE SUS CONEXIONES DE RED...")
QUIT
RETURN NIL
ELSE
MsgInfo( 'Conectado a '+cDatabase, 'Aviso' )
ENDIF
cMsgError:= "NO FUE POSIBLE CREAR LA BASE DE DATOS DEL SISTEMA, POR FAVOR VERIFIQUE" + HB_OsNewLine()+;
"QUE LAS CONEXIONES DE RED O DE INTERNET ESTE HABILITADAS"
cCmdQuery:= "CREATE DATABASE IF NOT EXISTS " + ALLTRIM( cDataBase )
IF !::oMaria:Execute( cCmdQuery )
MsgStop( cMsgError )
QUIT
RETURN NIL
ENDIF
cMsgError:= "NO FUE POSIBLE ABRIR LA BASE DE DATOS DEL SISTEMA, POR FAVOR VERIFIQUE" + HB_OsNewLine()+;
"QUE LAS CONEXIONES DE RED O DE INTERNET ESTE HABILITADAS"
cCmdQuery := "USE " + ALLTRIM(cDataBase)
IF !::oMaria:Execute( cCmdQuery )
MsgStop( cMsgError )
RETURN NIL
ENDIF
//-------------- INICIA APERTURA DE TABLAS --------------- //
If !::oMaria:Execute("SET SESSION wait_timeout=28880")
MsgStop( "ERROR AL INTENTAR ESTABLECER LA VARIABLE <wait_timeout>",'Error de conexión')
Application:Terminate()
Endif
If !::oMaria:Execute("SET SESSION interactive_timeout=28880")
MsgStop( "ERROR AL INTENTAR ESTABLECER LA VARIABLE <interactive_timeout>",'Error de conexión')
Application:Terminate()
Endif
If !::oMaria:Execute("SET SESSION sql_big_selects=1")
MsgStop( "ERROR AL INTENTAR ESTABLECER LA VARIABLE <sql_big_selects=1>",'Error de conexión')
Application:Terminate()
Endif
If !::oMaria:Execute("SET @lower_case_table_names=1")
MsgStop( "ERROR AL INTENTAR ESTABLECER LA VARIABLE <set @lower_case_table_names=1>",'Error de conexión')
Application:Terminate()
Endif
If !::oMaria:Execute("SET lc_time_names = 'es_ES'")
MsgStop( "ERROR AL INTENTAR ESTABLECER LA VARIABLE <SET lc_time_names>",'Error de conexión')
Application:Terminate()
Endif
END
MsgInfo( 'Base de Datos '+cDataBase+': Lista', 'Aviso' )
WITH OBJECT ::oPrueba
:oDataSource := ::oMaria
:cSelect := "select * from cliente"
:nCursorType := adOpenDynamic
:nLockType := adLockOptimistic
:cProcess := 'GENERAL'
IF :lOpen
:Close()
ENDIF
IF !:lOpen
:lOpen:= .T.
IF !:lOpen
MsgStop( "ERROR: No es posible abrir el archivo Cliente", "Error de conexion.." )
RETURN NIL
ENDIF
ENDIF
:lReadOnly := .F.
IF :RecCount() > 0
MsgInfo( 'Tengo Datos' )
ENDIF
END
Saludos