Page 1 of 2
Porting FW to FWH using MySql
Posted: Thu Feb 04, 2010 10:28 am
by wzaf
Hi all,
I'm porting my applications from FW to FWH .
I use MySql , and in FW I used class TDbOdbc in this way :
oDbf := TDbOdbc():new("SELECT * FROM mytab....... " , oOdbc)
and then I scan ODbf structure to retrieve data .
I use this method also in FWH and it work fine: why Antonio says that Tdbodbc is only for 16 bits ?
Is there any warning ?
best regards
wzaf
Re: Porting FW to FWH using MySql
Posted: Sun Feb 07, 2010 8:30 am
by Antonio Linares
Wzaf,
You can also use Class TDbODBC in 32 bits if you need it
Re: Porting FW to FWH using MySql
Posted: Sun Feb 07, 2010 6:29 pm
by wzaf
Thank you for your answer, Antonio ,
Anyway i started to port my programs to ADO and Adordd (with some difficulties) .
I use ADODB.connection and ADODB.recordset object, but I'm not able to find documentation: Do you know where I can find it ?
Best regards
Wzaf.
Re: Porting FW to FWH using MySql
Posted: Mon Feb 08, 2010 4:11 am
by anserkk
Dear Mr.Wzaf,
I'm not able to find documentation: Do you know where I can find it ?
http://www.w3schools.com/ado/default.asp
Regards
Anser
Re: Porting FW to FWH using MySql
Posted: Mon Feb 08, 2010 12:31 pm
by wzaf
Tank you Anser,
a very good site.
I still have a difficulty to handle the errors on a 'connection:execute' command :
Do you know how to catch the returned errors ?
Tank you
Regards
Wzaf
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 6:56 am
by anserkk
Dear Mr.Wzaf,
Code: Select all
Local oError
TRY
oCmd:Execute()
CATCH oError
MsgInfo( " Error No: "+AllTrim(STR(oError:NativeError))+CRLF+;
" Description : "+oError:Description)
END
Regards
Anser
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 8:34 am
by wzaf
Dear Anser,
Thank you , but I already tried this method and I get : "No exported method: NATIVEERROR" ,
instead the "oError:description" works fine.
Best regards
Wzaf
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 9:20 am
by anserkk
Dear Mr.Wzaf,
I hope that u r using ADO. Can u please provide the following info.
MySQL Ver
ODBC Driver ver
Your connection string
Regards
Anser
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 9:46 am
by wzaf
Dear Anser
Here they are :
mysql: 5.0.67
odbc: mysql ODBC 5.1 driver : 5.01.06.00
cConnectString := "Driver={MySQL ODBC 5.1 Driver};Server=localhost;Database=mydb; User=myuser;Password=mypassw;Option=3"
best regards
Wzaf
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 9:55 am
by anserkk
Are you able to connect to the database ?. If not please try the following con. string
Try the following connection string
Code: Select all
"Driver={MySQL ODBC 5.1 Driver};Server=192.168.0.170;Port=3306;Database=YourDbName;User=YourUserName;Password=YourPassword;Option=3;"
Regards
Anser
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 10:11 am
by wzaf
Anser ,
All works fine : I connect successfully : I correctly do SELECT and UPDATE in database.
I'm not able to correctly view the ADO errors (if there are...)
Regards
Wzaf
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 10:27 am
by anserkk
Dear Mr.Wzaf,
Code: Select all
*---------------------------------------------------*
Function ShowSqlError(oError)
*---------------------------------------------------*
FOR EACH oError IN oApp:oConnection:Errors
MsgInfo( " Error No: "+AllTrim(STR(oError:NativeError))+CRLF+;
" Descripcion : "+oError:Description, oApp:cAppName)
oApp:nLastErrorNo:=oError:NativeError
NEXT
RETURN ( NIL )
Regards
Anser
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 10:56 am
by wzaf
Thank you Anser , but what is object oApp ?
regards
Wzaf
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 11:19 am
by anserkk
Mr.Wzaf,
Instead of oApp:oConnection you may use your Connection Object
Code: Select all
*---------------------------------------------------*
Function ShowSqlError(oConnection)
*---------------------------------------------------*
FOR EACH oError IN oConnection:Errors
MsgInfo( " Error No: "+AllTrim(STR(oError:NativeError))+CRLF+;
" Descripcion : "+oError:Description)
NEXT
RETURN ( NIL )
Regards
Anser
Re: Porting FW to FWH using MySql
Posted: Tue Feb 09, 2010 1:34 pm
by wzaf
Dear Anser,
sorry but doesn't work
I get always "Argument error: __OLEENUMCREATE"
in line :
FOR EACH oError IN oConnection:Errors
regards
Wzaf