Page 1 of 2

MySql and AdoRdd

Posted: Tue May 12, 2009 12:01 am
by Jeff Barnes
Hi Everybody,

After many posts and lots of help I am getting closer to using an SQL database....

I was able to get my friend to let me use MySql and have the following code connecting to my test database

Code: Select all

#include "FiveWin.ch"
#include "ADORDD.ch"   

REQUEST ADORDD

Function Main()
   USE fusion VIA "ADORDD" TABLE "patients" MYSQL FROM "127.0.0.1" USER "fusion" PASSWORD "fusion"
   browse()
   USE
return nil
 
My problem is I get an error (always the same error) whenever I try to do anything to the data.
Browse, Append even a simple "Count To " causes the error.

The error is:

Unrecoverable error 9003:
Too many recursive error handler calls

I am so close and just need some guidance as to why I am getting this error.

Any ideas????

Re: MySql and AdrRdd

Posted: Tue May 12, 2009 1:47 am
by Jeff Barnes
Update....

If I add MsgInfo( e:Description ) to errsysw.prg it tells me:

DISP_E_UNKNOWNNAME


But what name is it referring to?

Re: MySql and AdrRdd

Posted: Tue May 12, 2009 1:58 am
by Armando
Jeff:

I'm afraid you are in a wrong way because there are not enough info about AdoRdd, I think the best way is to use ADO pure, you can search and found enough info in this forum.

Have a look to this link.

http://www.w3schools.com/ado/default.asp

Best regards and I'm so sorry for my poor english

Armando

Re: MySql and AdrRdd

Posted: Tue May 12, 2009 2:05 am
by Jeff Barnes
Never Mind.

I did not have records in the database :oops:

It works now. My very first successful MySql connection :D

Re: MySql and AdrRdd

Posted: Tue May 12, 2009 2:10 am
by Jeff Barnes
I spoke too soon ... I can browse the database but I get the same error when I try to add/modify the data.

Any ideas as to where I am going wrong?

Re: MySql and AdrRdd

Posted: Tue May 12, 2009 5:08 am
by anserkk
Dear Mr.Jeff,
I can browse the database but I get the same error when I try to add/modify the data.
If you have VARCHAR columns in the Table and if you try to add a Character type data without an Rtrim/Alltrim, then you may get error. That is just one of the reason and it is a very common mistake. There are other reasons too.

It is just a suggestion. As Mr.Armando suggested, I think it is better to use ADO instead of ADORDD. You will find lot of information and samples on how to use ADO in this forum as well as in the web. :D

Regards
Anser

Re: MySql and AdrRdd

Posted: Tue May 12, 2009 8:38 am
by dutch
I can open MySql with ADORDD as Jeff example BUT cannot append or delete or modify record. It alway shows an error.
Anyone could help and example for these cases?

Regards,
Dutch

Re: MySql and AdrRdd

Posted: Tue May 12, 2009 6:22 pm
by Jeff Barnes
Thanks Armando and Anserkk for you idea of using ADO directly, however, currently I would like to stick with the xbase style control over the database.
I really don't have the time to learn the ADO format :(

Does anyone know how to allow access to adding / modifying the data via an ADORDD connection?

Re: MySql and AdrRdd

Posted: Tue May 12, 2009 9:59 pm
by nageswaragunupudi
I do not use ADORDD normally. I use ADO directly.
But for this post I tested with ADORDD of xharbour.
I made only one small change in the adordd.prg. Changed the driver from 3.51 to 5.1.
ADORDD is working fine for me. I am able to add rows and modify rows.
Unless opened in exclusive mode, we should not forget locking and unlocking as we do in normal RDDs.

Personally I prefer using ADO directly, but for most pruposes ADORDD works fine.

Re: MySql and AdrRdd

Posted: Tue May 12, 2009 11:54 pm
by Jeff Barnes
I tried installing the 5.1 version of the MySql ODBC driver and made the change to Adordd.prg --- still errors every time I try to add or modify :cry:

Re: MySql and AdrRdd

Posted: Wed May 13, 2009 12:59 am
by Jeff Barnes
Almost there...

I am now able to edit the data (I removed both odbc drivers then installed just the 5.1 driver to try an clean things up a bit)

I still get errors when I try to append a record.

Anyone know how to get around this?

Re: MySql and AdrRdd

Posted: Wed May 13, 2009 8:33 am
by dutch
Dear Jeff,

How do you edit it?

Thanks,
Dutch

Re: MySql and AdrRdd

Posted: Wed May 13, 2009 12:43 pm
by Jeff Barnes
Hi Dutch,

This is what I did:

Code: Select all

#include "FiveWin.ch"
#include "ADORDD.ch"  
REQUEST ADORDD

Function Main()
   USE Fusion VIA "ADORDD" TABLE "patients" MYSQL FROM "127.0.0.1" USER "fusion" PASSWORD "fusion" ALIAS "Patients"
   go top
   Patients->Last := "xxxxxxxxxxx"
   BROWSE()   
   USE
return nil
 
If you do not use the "ALIAS" clause then you will need to try:

Code: Select all

Fusion->Last := "xxxxxxxxxxx"

Still can't figure out how to append a new record ... get an error every time I try.

Re: MySql and AdrRdd

Posted: Wed May 13, 2009 4:59 pm
by dutch
Thanks Jeff,

I found the function ADO_APPEND() in ADORDD.PRG but I don't understand why it cannot use. It shows the error "Unresolved external '_HB_FUN_ADO_APPEND'".

Regards,
Dutch

Re: MySql and AdrRdd

Posted: Wed May 13, 2009 5:04 pm
by Jeff Barnes
I tried that as well and also got that error.