Posté le 26 novembre 2014 - 19:01 |
Hola:
Estoy tratando de habilitar pool de conexiones, utilizando un ejemplo en VB6 y conexion ODBC a INFORMIX (esto es valido para cualquier BD, ya que el control se hace del lado del cliente),
La cuestion que desde VB6 me habilita perfectamente el pooling de conexion, ahora lo que intento es hacerlo desde windev este es el ejemplo en VB
////////////////////////// en VB6 Option Explicit Dim rc As Long
Const SQL_ATTR_CONNECTION_POOLING = 201 Const SQL_CP_ONE_PER_DRIVER = 1 Const SQL_IS_INTEGER = -6 Const SQL_CP_OFF = 0 Const SQL_DRIVER_AWARE_POOLING_SUPPORTED = 65572 ' 10024 - DIO N CON 65572
Const SQL_MAX_MESSAGE_LENGTH = 512 Const SQL_SUCCESS = 0 Const SQL_SUCCESS_WITH_INFO = 1 Const SQL_ATTR_ODBC_VERSION = 200 Const SQL_OV_ODBC3 = 3 Const SQL_HANDLE_DBC = 2 Const SQL_HANDLE_ENV = 1 Const SQL_NTS = -3 Const SQL_ERROR = -1 Const SQL_DRIVER_VER = 7 Const SQL_ODBC_VER = 10
Private Declare Function SQLSetEnvAttr Lib "ODBC32.DLL" ( _ ByVal EnvironmentHandle As Long, _ ByVal EnvAttribute As Long, _ ByVal ValuePtr As Long, _ ByVal StringLength As Long) As Integer
Private Declare Function SQLConnect Lib "ODBC32.DLL" (ByVal ldbc As Long, ByVal Server As String, _ ByVal serverlen As Integer, ByVal uid As String, ByVal uidlen As Integer, _ ByVal pwd As String, ByVal pwdlen As Integer) As Integer Private Declare Function SQLGetInfo Lib "ODBC32.DLL" (ByVal ldbc As Long, ByVal hWnd As Long, _ ByVal szInfo As String, ByVal cbInfoMax As Integer, cbInfoOut As Integer) As Integer Private Declare Function SQLAllocHandle Lib "ODBC32.DLL" (ByVal htype%, ByVal inhdl&, outhdl&) As Integer Private Declare Function SQLAllocEnv% Lib "ODBC32.DLL" (env&) Private Declare Function SQLDisconnect Lib "ODBC32.DLL" (ByVal conn&) As Integer
Private Sub Command2_Click()
Dim strSvrNme As String Dim intSvrLen As Integer Dim intI As Integer Dim GetServer As String Dim strDSN As String Dim uid As String Dim pwd As String Dim i As Long
Dim lngHenv As Long 'handle to the environment Dim lngHdbc As Long
uid = "informix" strDSN = "informix2" pwd = "xxxXXXxxxx"
' rc = SQLGetInfo(hdbc, SQL_DRIVER_VER, szNum, sizeof(szNum), NULL)
Dim rc2 As Integer
For i = 1 To 6
'--- pooling rc2 = SQLAllocEnv(lngHenv) rc = SQLSetEnvAttr(lngHdbc, SQL_ATTR_CONNECTION_POOLING, SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER) If rc <> 0 Then Debug.Print "SQLSetEnvAttr Error " & rc End If intI = SQLAllocHandle(SQL_HANDLE_DBC, lngHenv, lngHdbc) intI = SQLConnect(lngHdbc, strDSN, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS)
If (intI = SQL_SUCCESS) Or (intI = SQL_SUCCESS_WITH_INFO) Then strSvrNme = Space(SQL_MAX_MESSAGE_LENGTH) intI = SQLGetInfo(lngHdbc, SQL_DRIVER_AWARE_POOLING_SUPPORTED, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen) intI = SQLGetInfo(lngHdbc, SQL_DRIVER_VER, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen) intI = SQLGetInfo(lngHdbc, SQL_ODBC_VER, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen) If (intI = SQL_SUCCESS) Or (intI = SQL_SUCCESS_WITH_INFO) Then GetServer = VBA.Left$(strSvrNme, intSvrLen) Else GetServer = "" End If Else GetServer = "" End If MsgBox ("Antes de cerrar la conexion!") intI = SQLDisconnect(lngHdbc)
Next
End Sub
Private Sub Form_Load() 'Enable connection pooling .. this must be done before any ADO calls 'are made. Only needs to occur one time per process
' AQUI ACTIVA EL POOL DE CONEXION rc = SQLSetEnvAttr(0&, SQL_ATTR_CONNECTION_POOLING, SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER) If rc <> 0 Then Debug.Print "SQLSetEnvAttr Error " & rc End If End Sub
Private Sub Form_Unload(Cancel As Integer) Call SQLSetEnvAttr(0&, SQL_ATTR_CONNECTION_POOLING, SQL_CP_OFF, SQL_IS_INTEGER) End Sub
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Realizando una equivalencia en WLenguaje hice lo siguiente:
1. en la global tengo las siguientes constantes.
CONSTANT SQL_ATTR_CONNECTION_POOLING = 201 SQL_CP_ONE_PER_DRIVER = 1 SQL_IS_INTEGER = -6 SQL_CP_OFF = 0 SQL_DRIVER_AWARE_POOLING_SUPPORTED = 65572 // 10024 - DIO N CON 65572 SQL_MAX_MESSAGE_LENGTH = 512 SQL_SUCCESS = 0 SQL_SUCCESS_WITH_INFO = 1 SQL_ATTR_ODBC_VERSION = 200 SQL_OV_ODBC3 = 3 SQL_HANDLE_DBC = 2 SQL_HANDLE_ENV = 1 SQL_NTS = -3 SQL_ERROR = -1 SQL_DRIVER_VER = 7 SQL_ODBC_VER = 10 END
2. En un Boton hago lo siguente:
lngHdbc,lngHenv,nConetado, nDatos,intSvrLen is int
uid is string = "informix" strDSN is string = "informix2" pwd is string = "xxxXXXxxxx"
INTERO is int
// nDLL IS INT = LoadDLL("C:\Windows\System32\odbc32.dll") nDLL is int = LoadDLL("ODBC32.DLL") IF nDLL <> 0 THEN // CallDLL32("C:\Windows\System32\odbc32.dll","SQLAllocEnv",lngHenv) // CallDLL32("C:\Windows\System32\odbc32.dll", "SQLSetEnvAttr", lngHdbc, SQL_ATTR_CONNECTION_POOLING, SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER) // // // CallDLL32("C:\Windows\System32\odbc32.dll","SQLAllocHandle",SQL_HANDLE_DBC, lngHenv, lngHdbc) // // CallDLL32("C:\Windows\System32\odbc32.dll", "SQLConnect", lngHdbc, strDSN, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS)
// rc = SQLSetEnvAttr(0&, SQL_ATTR_CONNECTION_POOLING, SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER) // AQUI DEBERIA HABILITAR EL POOLING, PERO NO HACE NADA, COMO ME DOY CUENTA CON EL MONITOR DE PROCEDIMIENTOS DE WINDOWS nDatos = API("ODBC32.DLL", "SQLSetEnvAttr", &INTERO, SQL_ATTR_CONNECTION_POOLING, SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER)
CallDLL32("ODBC32.DLL","SQLAllocEnv",lngHenv) //API("C:\Windows\System32\odbc32.dll","SQLAllocEnv",LNGHENV) //CallDLL32("odbc32", "SQLSetEnvAttr", lngHdbc, SQL_ATTR_CONNECTION_POOLING, SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER) nHandler is int = CallDLL32("ODBC32.DLL","SQLAllocHandle",SQL_HANDLE_DBC, lngHenv, lngHdbc) nConetado = CallDLL32("ODBC32.DLL", "SQLConnect", lngHdbc, strDSN, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS) IF (nConetado = SQL_SUCCESS) OR (nConetado = SQL_SUCCESS_WITH_INFO) THEN strSvrNme is string= RepeatString(" ",SQL_MAX_MESSAGE_LENGTH) // intI = SQLGetInfo(lngHdbc, SQL_DRIVER_AWARE_POOLING_SUPPORTED, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen) // intI = SQLGetInfo(lngHdbc, SQL_DRIVER_VER, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen) // // intI = SQLGetInfo(lngHdbc, SQL_ODBC_VER, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen) // // If (intI = SQL_SUCCESS) Or (intI = SQL_SUCCESS_WITH_INFO) Then // GetServer = VBA.Left$(strSvrNme, intSvrLen) // Else // GetServer = "" // End If nConetado = CallDLL32("ODBC32.DLL", "SQLGetInfo", SQL_DRIVER_AWARE_POOLING_SUPPORTED, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen) nConetado = CallDLL32("ODBC32.DLL", "SQLGetInfo", SQL_DRIVER_VER, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen) nConetado = CallDLL32("ODBC32.DLL", "SQLGetInfo", SQL_ODBC_VER, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen) END ELSE Error(ErrorInfo()) END
// intI = SQLConnect(lngHdbc, strDSN, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS)
Info("TERMINO") FreeDLL(nDLL) CallDLL32("odbc32", "SQLDisconnect", lngHdbc)
Pueden ver que hice varias pruebas utilizando el API O el CALLDLL32 ambos me dan el mismo resultado... (no funciona).
Mi duda es si estoy realizando bien las equivalencia entre las declaraciones de VB6 y windev18.
Desde ya muchas gracias por su ayuda.
Victor.
Víctor H. Pereyra M.P. 2595
Departamento de Informática
Sucursal Nva . Cba .: Hipólito Yrigoyen 384 5000 Córdoba, Capital Tel.: (0351) 426 9200 int :1234
e-mail: vpereyra@sanatorioallende.com www.sanatorioallende.com.ar
<HTML><HEAD></HEAD> <BODY dir=ltr> <DIV dir=ltr> <DIV style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial'; COLOR: #000000"> <DIV>Hola:</DIV> <DIV> </DIV> <DIV>Estoy tratando de habilitar pool de conexiones, utilizando un ejemplo en VB6 y conexion ODBC a INFORMIX (esto es valido para cualquier BD, ya que el control se hace del lado del cliente),</DIV> <DIV> </DIV> <DIV>La cuestion que desde VB6 me habilita perfectamente el pooling de conexion, ahora lo que intento es hacerlo desde windev</DIV> <DIV>este es el ejemplo en VB</DIV> <DIV> </DIV> <DIV>////////////////////////// en VB6</DIV> <DIV>Option Explicit</DIV> <DIV>Dim rc As Long</DIV> <DIV> </DIV> <DIV>Const SQL_ATTR_CONNECTION_POOLING = 201</DIV> <DIV>Const SQL_CP_ONE_PER_DRIVER = 1</DIV> <DIV>Const SQL_IS_INTEGER = -6</DIV> <DIV>Const SQL_CP_OFF = 0</DIV> <DIV>Const SQL_DRIVER_AWARE_POOLING_SUPPORTED = 65572 ' 10024 - DIO N CON 65572</DIV> <DIV> </DIV> <DIV>Const SQL_MAX_MESSAGE_LENGTH = 512</DIV> <DIV>Const SQL_SUCCESS = 0</DIV> <DIV>Const SQL_SUCCESS_WITH_INFO = 1</DIV> <DIV>Const SQL_ATTR_ODBC_VERSION = 200</DIV> <DIV>Const SQL_OV_ODBC3 = 3</DIV> <DIV>Const SQL_HANDLE_DBC = 2</DIV> <DIV>Const SQL_HANDLE_ENV = 1</DIV> <DIV>Const SQL_NTS = -3</DIV> <DIV>Const SQL_ERROR = -1</DIV> <DIV>Const SQL_DRIVER_VER = 7</DIV> <DIV>Const SQL_ODBC_VER = 10</DIV> <DIV> </DIV> <DIV> </DIV> <DIV>Private Declare Function SQLSetEnvAttr Lib "ODBC32.DLL" ( _</DIV> <DIV>ByVal EnvironmentHandle As Long, _</DIV> <DIV>ByVal EnvAttribute As Long, _</DIV> <DIV>ByVal ValuePtr As Long, _</DIV> <DIV>ByVal StringLength As Long) As Integer</DIV> <DIV> </DIV> <DIV>Private Declare Function SQLConnect Lib "ODBC32.DLL" (ByVal ldbc As Long, ByVal Server As String, _</DIV> <DIV> ByVal serverlen As Integer, ByVal uid As String, ByVal uidlen As Integer, _</DIV> <DIV> ByVal pwd As String, ByVal pwdlen As Integer) As Integer</DIV> <DIV> </DIV> <DIV>Private Declare Function SQLGetInfo Lib "ODBC32.DLL" (ByVal ldbc As Long, ByVal hWnd As Long, _</DIV> <DIV> ByVal szInfo As String, ByVal cbInfoMax As Integer, cbInfoOut As Integer) As Integer</DIV> <DIV> </DIV> <DIV>Private Declare Function SQLAllocHandle Lib "ODBC32.DLL" (ByVal htype%, ByVal inhdl&, outhdl&) As Integer</DIV> <DIV>Private Declare Function SQLAllocEnv% Lib "ODBC32.DLL" (env&)</DIV> <DIV>Private Declare Function SQLDisconnect Lib "ODBC32.DLL" (ByVal conn&) As Integer</DIV> <DIV> </DIV> <DIV> </DIV> <DIV>Private Sub Command2_Click()</DIV> <DIV> </DIV> <DIV>Dim strSvrNme As String</DIV> <DIV>Dim intSvrLen As Integer</DIV> <DIV>Dim intI As Integer</DIV> <DIV>Dim GetServer As String</DIV> <DIV>Dim strDSN As String</DIV> <DIV>Dim uid As String</DIV> <DIV>Dim pwd As String</DIV> <DIV>Dim i As Long</DIV> <DIV> </DIV> <DIV>Dim lngHenv As Long 'handle to the environment</DIV> <DIV>Dim lngHdbc As Long</DIV> <DIV> </DIV> <DIV> </DIV> <DIV>uid = "informix"</DIV> <DIV>strDSN = "informix2"</DIV> <DIV>pwd = "xxxXXXxxxx"</DIV> <DIV> </DIV> <DIV>' rc = SQLGetInfo(hdbc, SQL_DRIVER_VER, szNum, sizeof(szNum), NULL)</DIV> <DIV> </DIV> <DIV>Dim rc2 As Integer</DIV> <DIV> </DIV> <DIV> </DIV> <DIV>For i = 1 To 6</DIV> <DIV> </DIV> <DIV> </DIV> <DIV> '--- pooling</DIV> <DIV> rc2 = SQLAllocEnv(lngHenv)</DIV> <DIV> rc = SQLSetEnvAttr(lngHdbc, SQL_ATTR_CONNECTION_POOLING, SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER)</DIV> <DIV> If rc <> 0 Then</DIV> <DIV> Debug.Print "SQLSetEnvAttr Error " & rc</DIV> <DIV> End If</DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> intI = SQLAllocHandle(SQL_HANDLE_DBC, lngHenv, lngHdbc)</DIV> <DIV> intI = SQLConnect(lngHdbc, strDSN, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS)</DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> If (intI = SQL_SUCCESS) Or (intI = SQL_SUCCESS_WITH_INFO) Then</DIV> <DIV> strSvrNme = Space(SQL_MAX_MESSAGE_LENGTH)</DIV> <DIV> intI = SQLGetInfo(lngHdbc, SQL_DRIVER_AWARE_POOLING_SUPPORTED, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen)</DIV> <DIV> intI = SQLGetInfo(lngHdbc, SQL_DRIVER_VER, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen)</DIV> <DIV> </DIV> <DIV> intI = SQLGetInfo(lngHdbc, SQL_ODBC_VER, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen)</DIV> <DIV> </DIV> <DIV> If (intI = SQL_SUCCESS) Or (intI = SQL_SUCCESS_WITH_INFO) Then</DIV> <DIV> GetServer = VBA.Left$(strSvrNme, intSvrLen)</DIV> <DIV> Else</DIV> <DIV> GetServer = ""</DIV> <DIV> End If</DIV> <DIV> Else</DIV> <DIV> GetServer = ""</DIV> <DIV> End If</DIV> <DIV> MsgBox ("Antes de cerrar la conexion!")</DIV> <DIV> </DIV> <DIV> </DIV> <DIV> intI = SQLDisconnect(lngHdbc)</DIV> <DIV> </DIV> <DIV>Next</DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV>End Sub</DIV> <DIV> </DIV> <DIV>Private Sub Form_Load()</DIV> <DIV>'Enable connection pooling .. this must be done before any ADO calls 'are made. Only needs to occur one time per process</DIV> <DIV> </DIV> <DIV>' AQUI ACTIVA EL POOL DE CONEXION</DIV> <DIV>rc = SQLSetEnvAttr(0&, SQL_ATTR_CONNECTION_POOLING, SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER)</DIV> <DIV>If rc <> 0 Then</DIV> <DIV> Debug.Print "SQLSetEnvAttr Error " & rc</DIV> <DIV>End If</DIV> <DIV>End Sub</DIV> <DIV> </DIV> <DIV>Private Sub Form_Unload(Cancel As Integer)</DIV> <DIV> Call SQLSetEnvAttr(0&, SQL_ATTR_CONNECTION_POOLING, SQL_CP_OFF, SQL_IS_INTEGER)</DIV> <DIV>End Sub</DIV> <DIV> </DIV> <DIV>///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////</DIV> <DIV>Realizando una equivalencia en WLenguaje hice lo siguiente:</DIV> <DIV> </DIV> <DIV><FONT color=#0000ff>1. en la global tengo las siguientes constantes.</FONT></DIV> <DIV><FONT color=#0000ff></FONT> </DIV> <DIV><FONT color=#0000ff>CONSTANT</FONT></DIV> <DIV><FONT color=#0000ff> SQL_ATTR_CONNECTION_POOLING = 201</FONT></DIV> <DIV><FONT color=#0000ff> SQL_CP_ONE_PER_DRIVER = 1</FONT></DIV> <DIV><FONT color=#0000ff> SQL_IS_INTEGER = -6</FONT></DIV> <DIV><FONT color=#0000ff> SQL_CP_OFF = 0</FONT></DIV> <DIV><FONT color=#0000ff> SQL_DRIVER_AWARE_POOLING_SUPPORTED = 65572 // 10024 - DIO N CON 65572</FONT></DIV> <DIV><FONT color=#0000ff> SQL_MAX_MESSAGE_LENGTH = 512</FONT></DIV> <DIV><FONT color=#0000ff> SQL_SUCCESS = 0</FONT></DIV> <DIV><FONT color=#0000ff> SQL_SUCCESS_WITH_INFO = 1</FONT></DIV> <DIV><FONT color=#0000ff> SQL_ATTR_ODBC_VERSION = 200</FONT></DIV> <DIV><FONT color=#0000ff> SQL_OV_ODBC3 = 3</FONT></DIV> <DIV><FONT color=#0000ff> SQL_HANDLE_DBC = 2</FONT></DIV> <DIV><FONT color=#0000ff> SQL_HANDLE_ENV = 1</FONT></DIV> <DIV><FONT color=#0000ff> SQL_NTS = -3</FONT></DIV> <DIV><FONT color=#0000ff> SQL_ERROR = -1</FONT></DIV> <DIV><FONT color=#0000ff> SQL_DRIVER_VER = 7</FONT></DIV> <DIV><FONT color=#0000ff> SQL_ODBC_VER = 10</FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff>END</FONT></DIV> <DIV><FONT color=#0000ff></FONT> </DIV> <DIV><FONT color=#0000ff>2. En un Boton hago lo siguente:</FONT></DIV> <DIV><FONT color=#0000ff></FONT> </DIV> <DIV><FONT color=#0000ff></FONT> </DIV> <DIV><FONT color=#0000ff>lngHdbc,lngHenv,nConetado, nDatos,intSvrLen is int</FONT></DIV> <DIV><FONT color=#0000ff></FONT> </DIV> <DIV><FONT color=#0000ff>uid is string = "informix"</FONT></DIV> <DIV><FONT color=#0000ff>strDSN is string = "informix2"</FONT></DIV> <DIV><FONT color=#0000ff>pwd is string = "xxxXXXxxxx"</FONT></DIV> <DIV><FONT color=#0000ff></FONT> </DIV> <DIV><FONT color=#0000ff>INTERO is int</FONT></DIV> <DIV><FONT color=#0000ff></FONT> </DIV> <DIV><FONT color=#0000ff></FONT> </DIV> <DIV><FONT color=#0000ff>// nDLL IS INT = LoadDLL("C:\Windows\System32\odbc32.dll")</FONT></DIV> <DIV><FONT color=#0000ff>nDLL is int = LoadDLL("ODBC32.DLL")</FONT></DIV> <DIV><FONT color=#0000ff>IF nDLL <> 0 THEN</FONT></DIV> <DIV><FONT color=#0000ff>// CallDLL32("C:\Windows\System32\odbc32.dll","SQLAllocEnv",lngHenv)</FONT></DIV> <DIV><FONT color=#0000ff>// CallDLL32("C:\Windows\System32\odbc32.dll", "SQLSetEnvAttr", lngHdbc, SQL_ATTR_CONNECTION_POOLING, SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER)</FONT></DIV> <DIV><FONT color=#0000ff>// </FONT></DIV> <DIV><FONT color=#0000ff>// </FONT></DIV> <DIV><FONT color=#0000ff>// CallDLL32("C:\Windows\System32\odbc32.dll","SQLAllocHandle",SQL_HANDLE_DBC, lngHenv, lngHdbc)</FONT></DIV> <DIV><FONT color=#0000ff>//</FONT></DIV> <DIV><FONT color=#0000ff>// CallDLL32("C:\Windows\System32\odbc32.dll", "SQLConnect", lngHdbc, strDSN, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS)</FONT></DIV> <DIV><FONT color=#0000ff></FONT> </DIV> <DIV><FONT color=#0000ff>// rc = SQLSetEnvAttr(0&, SQL_ATTR_CONNECTION_POOLING, SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER)</FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff> // AQUI DEBERIA HABILITAR EL POOLING, PERO NO HACE NADA, COMO ME DOY CUENTA CON EL MONITOR DE PROCEDIMIENTOS DE WINDOWS</FONT></DIV> <DIV><FONT color=#0000ff> nDatos = API("ODBC32.DLL", "SQLSetEnvAttr", &INTERO, SQL_ATTR_CONNECTION_POOLING, SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER)</FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff></FONT> </DIV> <DIV><FONT color=#0000ff> CallDLL32("ODBC32.DLL","SQLAllocEnv",lngHenv)</FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff> //API("C:\Windows\System32\odbc32.dll","SQLAllocEnv",LNGHENV)</FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff> //CallDLL32("odbc32", "SQLSetEnvAttr", lngHdbc, SQL_ATTR_CONNECTION_POOLING, SQL_CP_ONE_PER_DRIVER, SQL_IS_INTEGER)</FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff> nHandler is int = CallDLL32("ODBC32.DLL","SQLAllocHandle",SQL_HANDLE_DBC, lngHenv, lngHdbc)</FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff> nConetado = CallDLL32("ODBC32.DLL", "SQLConnect", lngHdbc, strDSN, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS)</FONT></DIV> <DIV><FONT color=#0000ff> IF (nConetado = SQL_SUCCESS) OR (nConetado = SQL_SUCCESS_WITH_INFO) THEN</FONT></DIV> <DIV><FONT color=#0000ff> strSvrNme is string= RepeatString(" ",SQL_MAX_MESSAGE_LENGTH)</FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff>// intI = SQLGetInfo(lngHdbc, SQL_DRIVER_AWARE_POOLING_SUPPORTED, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen)</FONT></DIV> <DIV><FONT color=#0000ff>// intI = SQLGetInfo(lngHdbc, SQL_DRIVER_VER, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen)</FONT></DIV> <DIV><FONT color=#0000ff>// </FONT></DIV> <DIV><FONT color=#0000ff>// intI = SQLGetInfo(lngHdbc, SQL_ODBC_VER, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen)</FONT></DIV> <DIV><FONT color=#0000ff>// </FONT></DIV> <DIV><FONT color=#0000ff>// If (intI = SQL_SUCCESS) Or (intI = SQL_SUCCESS_WITH_INFO) Then</FONT></DIV> <DIV><FONT color=#0000ff>// GetServer = VBA.Left$(strSvrNme, intSvrLen)</FONT></DIV> <DIV><FONT color=#0000ff>// Else</FONT></DIV> <DIV><FONT color=#0000ff>// GetServer = ""</FONT></DIV> <DIV><FONT color=#0000ff>// End If</FONT></DIV> <DIV><FONT color=#0000ff> nConetado = CallDLL32("ODBC32.DLL", "SQLGetInfo", SQL_DRIVER_AWARE_POOLING_SUPPORTED, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen)</FONT></DIV> <DIV><FONT color=#0000ff> nConetado = CallDLL32("ODBC32.DLL", "SQLGetInfo", SQL_DRIVER_VER, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen)</FONT></DIV> <DIV><FONT color=#0000ff> nConetado = CallDLL32("ODBC32.DLL", "SQLGetInfo", SQL_ODBC_VER, strSvrNme, SQL_MAX_MESSAGE_LENGTH, intSvrLen)</FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff> END</FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff> </FONT></DIV> <DIV><FONT color=#0000ff>ELSE</FONT></DIV> <DIV><FONT color=#0000ff> Error(ErrorInfo()) </FONT></DIV> <DIV><FONT color=#0000ff>END</FONT></DIV> <DIV><FONT color=#0000ff></FONT> </DIV> <DIV><FONT color=#0000ff>// intI = SQLConnect(lngHdbc, strDSN, SQL_NTS, uid, SQL_NTS, pwd, SQL_NTS)</FONT></DIV> <DIV><FONT color=#0000ff></FONT> </DIV> <DIV><FONT color=#0000ff>Info("TERMINO")</FONT></DIV> <DIV><FONT color=#0000ff>FreeDLL(nDLL)</FONT></DIV> <DIV><FONT color=#0000ff>CallDLL32("odbc32", "SQLDisconnect", lngHdbc)</FONT></DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV>Pueden ver que hice varias pruebas utilizando el API O el CALLDLL32 ambos me dan el mismo resultado... (no funciona).</DIV> <DIV> </DIV> <DIV>Mi duda es si estoy realizando bien las equivalencia entre las declaraciones de VB6 y windev18.</DIV> <DIV> </DIV> <DIV> </DIV> <DIV>Desde ya muchas gracias por su ayuda.</DIV> <DIV> </DIV> <DIV>Victor.</DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV>Víctor H. Pereyra </DIV> <DIV>M.P. 2595 </DIV> <DIV> </DIV> <DIV>Departamento de Informática </DIV> <DIV> </DIV> <DIV>Sucursal Nva . Cba .: Hipólito Yrigoyen 384 </DIV> <DIV>5000 Córdoba, Capital </DIV> <DIV>Tel.: (0351) 426 9200 int :1234 </DIV> <DIV> </DIV> <DIV>e-mail: vpereyra@sanatorioallende.com </DIV> <DIV>www.sanatorioallende.com.ar </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV> <DIV> </DIV></DIV></DIV></BODY></HTML> |
| |
| |
|