AHF wrote:Enrico,
Ok thats what adordd expects.
Do you have the same field name in every table?
This is your choice. I use "ID" but you may prefer "something" + tablename so you won't have problems with the queries.
EMG
AHF wrote:Enrico,
Ok thats what adordd expects.
Do you have the same field name in every table?
This is your choice. I use "ID" but you may prefer "something" + tablename so you won't have problems with the queries.
SET ADO TABLES INDEX LIST TO { {"SECTOR",{"SECTOR","SECTORES"} },;
{"CCLIENTE",{"COD_CLI","CODCLIENTE"},;
{"CLIENTE","NOME"},{"CTEMP2","VENDEDOR,SECTOR,CODCLIENTE"} } }
SET ADO TEMPORAY NAMES INDEX LIST TO {"TMP","TEMP"}
SET ADO FIELD RECNO TABLES LIST TO {{"ENCCLIST","ID"},{"FACTURAS","IDRECNO"}}
SET ADO DEFAULT FIELD RECNO TO "HBRECNO"
AHF wrote:
- Code: Select all Expand view RUN
SET ADO TABLES INDEX LIST TO { {"SECTOR",{"SECTOR","SECTORES"} },;
{"CCLIENTE",{"COD_CLI","CODCLIENTE"},;
{"CLIENTE","NOME"},{"CTEMP2","VENDEDOR,SECTOR,CODCLIENTE"} } }
SET ADO FIELD RECNO TABLES LIST TO {{"ENCCLIST","ID"},{"FACTURAS","IDRECNO"}}
SET ADO DEFAULT FIELD RECNO TO "HBRECNO"
hmpaquito wrote:This is your choice. I use "ID" but you may prefer "something" + tablename so you won't have problems with the queries.
Which problems ?
IMHO Its seems what same field for all tables is a more clear solution. (hbrecno)
DbCreate( <cDatabase> , ;
<aStructure>, ;
[<cDriver>] , ;
[<lNewArea>] , ;
[<cAlias>] ) --> NIL
#include "fivewin.ch"
#include "adordd\adordd.ch"
#include "adordd\adordd.prg"
REQUEST ADORDD
function Main()
local aArray := {}
RDDSETDEFAULT( "ADORDD" )
IF !FILE( "test2.mdb" )
DbCreate( "test2.mdb;table1", { { "FIRST", "C", 30, 0 },;
{ "LAST", "C", 30, 0 },;
{ "AGE", "N", 8, 0 } }, "ADORDD" )
ENDIF
USE test2.mdb VIA "ADORDD" TABLE "table1" NEW ALIAS "TEST2"
XBROWSER FASTEDIT
APPEND BLANK
test2->First := "HOMER si no Homer"
test2->Last := "Simpson"
test2->Age := 45
APPEND BLANK
test2->First := "aaa Lara"
test2->Last := "Croft si no"
test2->Age := 32
GO TOP
xBrowse()
DbCloseAll()
return nil
I think we should use always HBRECNO, as it´s not a common field name like ID, which is the one I use. In fact, SQLRDD from xHarbour.com uses a private field for such purpouses.
I also think ADORDD should be able to create "tables", with dbcreate.
In fact, to achieve the equal behaviour as DBFCDX, index auto open should be present.
Define at FUNCTION ListIndex() the indexes. They will be opened with SET INDEX TO INDEX1, INDEX2, INDEX3... if SET AUTOPEN is OFF.
Define globally with a SetUp ADORDD function the RBDM type (Access, MSSQL, MySQL..), the server, the user name, the password to connect and the database name.
DbCreate now needs to pass some extra parameeters with ;. Once the above function is created, DBcreate should work as ordinary in DBFCDX:
Sorry, it´s not working.
Test simple:
Code:
#include "fivewin.ch"
#include "adordd\adordd.ch"
#include "adordd\adordd.prg"
Error description: Error BASE/1068 Argument error: array access
Args:
[ 1] = U
[ 2] = N 1
Stack Calls
===========
Called from: lucas.prg => (b)ADO_INDEXAUTOOPEN( 1269 )
Called from: => ASCAN( 0 )
Called from: lucas.prg => ADO_INDEXAUTOOPEN( 1269 )
Called from: lucas.prg => ADO_OPEN( 382 )
Called from: => DBUSEAREA( 0 )
Called from: lucas.prg => MAIN( 31 )
Error description: Error BASE/1075 Argument error: >
Args:
[ 1] = N 1
[ 2] = C
Stack Calls
===========
Called from: .\source\classes\DATABASE.PRG => ORDERTAGINFO( 1258 )
Called from: .\source\classes\XBROWSE.PRG => TXBROWSE:SETRDD( 4135 )
Called from: .\source\classes\XBROWSE.PRG => XBRWSETDATASOURCE( 13030 )
Called from: .\source\function\XBROWSER.PRG => XBROWSE( 112 )
Called from: lucas.prg => MAIN( 35 )
Called from: .\source\classes\DATABASE.PRG => ORDERTAGINFO( 1258 )
function OrderTagInfo( aStruct, nCol )
local nFor, nAt, i, nOrders, aTokens, lCond, aCond, aPos
DEFAULT aStruct := DbStruct(), ;
nCol := DBS_TAG
aCond := Array( Len( aStruct ) ); AFill( aCond, .f. )
aPos := Array( Len( aStruct ) ); AFill( aPos, 0 )
for nFor := 1 to Len( aStruct )
if Len( aStruct[ nFor ] ) < nCol
ASize( aStruct[ nFor ], nCol )
endif
next nFor
nOrders := OrdCount()
for nFor := 1 to nOrders
lCond := ! Empty( OrdFor() )
aTokens := GetTokens( OrdKey( nFor ) )
for i := 1 to Len( aTokens )
nAt := AScan( aStruct, { |aFld| aFld[ 1 ] == aTokens[ i ] } )
if nAt > 0
if aStruct[ nAt ][ nCol ] == nil .or. ( aCond[ nAt ] .and. ! lCond ) .or. ;
( aPos[ nAt ] > i )
aStruct[ nAt ][ nCol ] := Upper( OrdName( nFor ) )
aCond[ nAt ] := lCond
aPos[ nAt ] := i
endif
EXIT
endif
next i
next nFor
return aStruct
Return to FiveWin for Harbour/xHarbour
Users browsing this forum: Google [Bot] and 19 guests