Page 12 of 14

PostPosted: Sun Oct 26, 2008 1:20 pm
by Antonio Linares
Willy,

It works fine for basic database management.

Its good for using ADO if you don't know anything about ADO or if you want that ADO is managed automatically :-)

Re: Sample

PostPosted: Wed Oct 29, 2008 2:45 am
by goosfancito
Hello,
Can you post one example Insert, Update, browse using ADO + ORACLE? thank´s.

Gustavo.
digicad wrote:#include "adordd.ch"

REQUEST ADORDD

function Main()
LOCAL db


/*
// Example for creation of Oracle connection string
cDataSource := ""
cUserID := "digi"
cPassword := "digi"
OPEN CONNECTION "Provider=MSDAORA.1;Persist Security Info=False"+IIF( cDataSource == "", "", ";Data source=" + cDataSource ) + ";User ID=" + cUserID + ";Password=" + cPassword TO db
USE NewQuery VIA "ADORDD" QUERY "SELECT Objekat# AS Sifra, Naziv, NVL(X,0) AS XCOOR, NVL(Y,0) AS YCOOR FROM Objekat ORDER BY Sifra" NEW
*/



// Example for creation of MySQL connection string
cServer := "www.freesql.org"
cUserID := "myuser"
cPassword := "mypass"
cDatabase := "test00"
OPEN CONNECTION "DRIVER={MySQL ODBC 3.51 Driver};database="+cDatabase+";server=" + cServer + ";uid=" + cUserID + ";pwd=" + cPassword TO db
USE Accounts VIA "ADORDD" TABLE "ACCOUNTS" NEW


/*
// Example for creation of Access connection string
cDatabase := "Test.MDB"
OPEN CONNECTION "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + cDataBase TO db
USE SampleAccess VIA "ADORDD" TABLE "Tabla1" NEW
*/

Browse()
CLOSE ALL

return nil

Re: New AdoRDD (free)

PostPosted: Tue Jun 02, 2009 5:08 am
by lailton.webmaster
I´m tring use more show me GPF when execute mysql.EXE

Re: New AdoRDD (free)

PostPosted: Tue Oct 13, 2009 8:50 am
by mbelgrano
Hi antonio

i copied from a mail posted by Roberto lopez on harbour developer mailing list
testing adordd with harbour beta3 and found a problem with rddado sample.
Harbour 2.0 Beta 3 http://www.syenar.hu/harbour/
will the problem due by new ole?

The sample (contrib\rddado\access1.prg) works, but exiting browse with [ESC] it gives the following error:

Error BASE/3012 Argument error: FIND
Called from WIN_OLEAUTO:FIND(0) OPEN
Called from ADO_LOCATE(0) N(0)
Called from __DBLOCATE(0)
Called from MAIN(34) 0)
Called from MAIN(11)

I've compiled with: 'hbmk2 access2.prg'

If you modify the sample to display recno() value you'll find that it always return 0 (It worked fine in Harbour 1.01)

This problem causes that HMG RDDADO Browse samples to crash, since HMG browse control relies on values returned by recno() function (of course, this is a problem for non-HMG users too).



Will be usefull a function that return ado version using oConnection.Version
The only source of rddado.lib is rddado.prg & adordd.ch a rdd wil be
done in prg thanks to usrrd

Re: New AdoRDD (free)

PostPosted: Wed Oct 14, 2009 8:34 am
by Antonio Linares
Massimo,

In Harbour's OLE implementation, the error value returned in HRESULT from a Method call is reported as an arguments error, without providing any extra OLE error information:
Code: Select all  Expand view

      if( lOleError != S_OK )
         hb_errRT_BASE_SubstR( EG_ARG, 3012, NULL, HB_ERR_FUNCNAME, HB_ERR_ARGS_BASEPARAMS );
 

A workaround to get more info about the OLE error is to modify the error block:
Code: Select all  Expand view

   ErrorBlock( { | o | MsgInfo( WIN_OLEERRORTEXT(), ProcLine( 2 ) ) } )
 

that way Roberto will be able to get a better feedback about the error

In xharbour, the equivalent function name is OLE2TXTERROR()

Re: New AdoRDD (free)

PostPosted: Fri Oct 16, 2009 3:36 pm
by mbelgrano
I receive error DISP_E_EXCEPTION after press esc to exit from browse
and after my recno() display 0

Please Antonio
Can you help me?

#include "adordd.ch"
REQUEST ADORDD
function Main()
ErrorBlock( { | o | alert( WIN_OLEERRORTEXT(), ProcLine( 2 ) ) } )
DbCreate( "test2.mdb;table1", { { "FIRST", "C", 10, 0 },;
{ "LAST", "C", 10, 0 },;
{ "AGE", "N", 8, 0 } }, "ADORDD" )

USE test2.mdb VIA "ADORDD" TABLE "table1"

APPEND BLANK
test2->First := "Homer"
test2->Last := "Simpson"
test2->Age := 45

APPEND BLANK
test2->First := "Lara"
test2->Last := "Croft"
test2->Age := 32


GO TOP
Browse()

GO TOP
locate for TEST2->First = "Lara"
? FOUND()
? "Recno"
?? recno() // here display 0
USE

return nil

Re: New AdoRDD (free)

PostPosted: Fri Oct 16, 2009 7:23 pm
by Antonio Linares
Massimo,

Have you tested it in Windows 7 ?

Re: New AdoRDD (free)

PostPosted: Mon Oct 19, 2009 1:34 pm
by mbelgrano
I try win7 in next hours (it is at home)
is sufficent run executable?
or want recompile entire harbour, or application

Re: New AdoRDD (free)

PostPosted: Mon Oct 19, 2009 4:02 pm
by mbelgrano
Follow result on win 7 (32 bit) seem similarof WINDOWS VISTA
Harbour with rddado Recompiled from CVS

access1.prg
Error base 3012 argument error Open

access2.prg
Work dbedit
after dbedit receive Error base 3012 argument error find
accesstst.prg modified version under Antonio's indication
DISP_E_EXCEPTION

if you send me via mail your executable renamed and zipped i can try with it Windows 7 32/64

Re: New AdoRDD (free)

PostPosted: Mon Oct 19, 2009 7:43 pm
by Antonio Linares
Massimo,

We get the same errors here :-(

It seems as Harbour new OLE is broken somehow or that ADO for MDB is different now.

Re: New AdoRDD (free)

PostPosted: Mon Oct 19, 2009 10:50 pm
by mbelgrano
Imo the problem non seem ole related
IMO adordd not undestrand xbase alias
// http://msdn.microsoft.com/en-us/library/ee275542(BTS.10).aspx
Follow sample try reproduce two problem recno,find
FUNCTION MAIN()
LOCAL oRs := CREATEOBJECT( "ADODB.Recordset" )
oRs:Open( "SELECT * FROM table1 ORDER BY First", "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=test.mdb", 2, 1 )
ORS:FIND("First = 'Lara'",0) // OK
? "recno"
?? iif( oRS:AbsolutePosition == -3, oRS:RecordCount() + 1, oRS:AbsolutePosition )
? "second"
ORS:FIND("Table1->First = 'Lara'",0) // ERROR
RETURN

// error also
ORS:FIND("[Table1]![First] = 'Lara'",0) // ERROR

Antonio Linares wrote:Massimo,
We get the same errors here :-(
It seems as Harbour new OLE is broken somehow or that ADO for MDB is different now.

Re: New AdoRDD (free)

PostPosted: Tue Oct 20, 2009 7:12 am
by Antonio Linares
Massimo,

You have to do it this way:

ORS:FIND( "First = 'Lara'", 0 )

as the recordset already selected the Table1 table

Re: New AdoRDD (free)

PostPosted: Tue Oct 20, 2009 9:19 am
by mbelgrano
problem is that in original sample msaccess2.prg work fine with :
locate for First = "Lara"
istead not work
locate for TEST2->First = "Lara"
IMO is a internal problem of adordd that is not able manage alias
need in sqltranslate SOMETHING LIKE
cExpr := StrTran( cExpr, ALIAS()+"->", "" )
but case insensitive

Antonio Linares wrote:Massimo,
You have to do it this way:
ORS:FIND( "First = 'Lara'", 0 )
as the recordset already selected the Table1 table

Re: New AdoRDD (free)

PostPosted: Tue Oct 20, 2009 10:27 am
by Antonio Linares
Massimo,

Alias are automatically managed by the Harbour RDD engine.

ADO does not need to manage alias at all :-)

Re: New AdoRDD (free)

PostPosted: Tue Oct 20, 2009 11:05 am
by mbelgrano
I have printed in ado_locate find
and AWADATA[WA_SCOPEINFO][UR_SI_CFOR]
contain alias so generate error

Have you a solution or better not wasting our time on rddado?

Intresting for future replacement od ADO http://pear.php.net/package/MDB2

Antonio Linares wrote:Massimo,
Alias are automatically managed by the Harbour RDD engine.
ADO does not need to manage alias at all :-)