Hola amigos del Foro,
Estoy incursionando el tema d elos 32 bits y estoy tratando con MySql 5.01 + FWH 7.01 + xharbour 0.99.7, el programita de captura compila bien, pero al correrlo me genera error,
Desde ya les agradezco su ilumnacion al respecto, algo debo estar haciendo mal,
El codigo y el error es el siguiente :
#Include "Fivewin.ch"
#Include "Ado.ch"
FUNCTION MAIN() ...
...
....
//====================
FUNCTION CARGOS()
//====================
Public oCod,oNombre,oDlg,mCod,mNombre
mCod = space(5)
mNombre = space(40)
DEFINE DIALOG oDlg RESOURCE 2
REDEFINE GET oCod Var mCod ID 101 of oDlg
REDEFINE GET oNombre Var mNombre ID 102 of oDlg
REDEFINE BUTTON ID 105 of oDlg ACTION( AGREGO(), oDlg:End())
REDEFINE BUTTON ID 106 of oDlg ACTION( oDlg:End())
ACTIVATE DIALOG oDlg CENTERED
DBCLOSEALL()
RETURN NIL
//==========================
STATIC FUNCTION AGREGO()
//==========================
Public oConexionAdo := TOLEAUTO():New("adodb.connection")
Public oRecordSet
Public oCommand := TOleAuto():New("adodb.command")
oConexionAdo:Open("DRIVER={MySQL ODBC 3.51 Driver}; SERVER=127.0.0.1 ; DATABASE=Personal1; UID=root; PWD=123")
oRecordSet := TOleAuto():New("adodb.recordset")
oRecordSet:LockType := adLockOptimistic
oRecordSet:CursorType := adOpenKeyset
oRecordSet:ActiveConnection(oConexionAdo)
oRecordSet:Source := "SELECT * FROM CARGOS"
oRecordSet:Open()
oRecordSet:AddNew()
oRecordSet:Fields("Codigo"):Value := mCod //==========> ME MARCA EL ERROR AQUI
oRecordSet:Fields("Descrip"):value := mNombre
oRecordSet:Update()
oConexionAdo:Close()
RETURN NIL
Nota: Los campos en la tabla de la BD MySql son char de 5, el primero y
char de 40 el segundo probe con varchar y lo mismo da error
// ESTE ES EL LOG
Application
===========
Path and name: C:\sistemas\RRHH_32\personal.exe (32 bits)
Size: 1,381,888 bytes
Time from start: 0 hours 0 mins 11 secs
Error occurred at: 15/03/2007, 21:33:47
Error description: Error adodb.recordset:FIELDS/16389 E_FAIL: _VALUE
Args:
[ 1] = C 09899
Stack Calls
===========
Called from: win32ole.prg => TOLEAUTO:_VALUE(0)
Called from: => AGREGO(382)
Called from: personal.prg => (b)CARGOS(353)
Called from: BUTTON.PRG => TBUTTON:CLICK(0)
Called from: CONTROL.PRG => TBUTTON:HANDLEEVENT(0)
Called from: WINDOW.PRG => _FWH(0)
Called from: => SENDMESSAGE(0)
Called from: DIALOG.PRG => TDIALOG:COMMAND(0)
Called from: WINDOW.PRG => TWINDOW:HANDLEEVENT(0)
Called from: DIALOG.PRG => TDIALOG:HANDLEEVENT(0)
Called from: => DIALOGBOX(0)
Called from: DIALOG.PRG => TDIALOG:ACTIVATE(0)
Called from: personal.prg => CARGOS(356)
Called from: personal.prg => (b)CREAMENU(123)
Called from: MENU.PRG => TMENU:COMMAND(0)
Called from: WINDOW.PRG => TWINDOW:COMMAND(0)
Called from: WINDOW.PRG => TWINDOW:HANDLEEVENT(0)
Called from: WINDOW.PRG => _FWH(0)
Called from: => WINRUN(0)
Called from: WINDOW.PRG => TWINDOW:ACTIVATE(0)
Called from: personal.prg => PRINCIPAL(82)
System
======
CPU type: Intel(R) Celeron(R) M processor 1.60GHz 1600 Mhz
Hardware memory: 447 megs
Free System resources: 90 %
GDI resources: 90 %
User resources: 90 %
Compiler version: xHarbour build 0.99.71 Intl. (SimpLex)
Windows version: 5.1, Build 2600 Service Pack 2
Windows total applications running: 49