This is your choice. I use "ID" but you may prefer "something" + tablename so you won't have problems with the queries.AHF wrote:Enrico,
Ok thats what adordd expects.
Do you have the same field name in every table?
EMG
This is your choice. I use "ID" but you may prefer "something" + tablename so you won't have problems with the queries.AHF wrote:Enrico,
Ok thats what adordd expects.
Do you have the same field name in every table?
Which problems ?This is your choice. I use "ID" but you may prefer "something" + tablename so you won't have problems with the queries.
Code: Select all
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
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"
Problem with joins. In a join you can't have field with same name from different tables so you have to use AS clause.hmpaquito wrote:Which problems ?This is your choice. I use "ID" but you may prefer "something" + tablename so you won't have problems with the queries.
IMHO Its seems what same field for all tables is a more clear solution. (hbrecno)
Code: Select all
DbCreate( <cDatabase> , ;
<aStructure>, ;
[<cDriver>] , ;
[<lNewArea>] , ;
[<cAlias>] ) --> NIL
Code: Select all
#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 choose to give this to the developer. Please see my previous post about SET...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.
You can.I also think ADORDD should be able to create "tables", with dbcreate.
It is working.In fact, to achieve the equal behaviour as DBFCDX, index auto open should be present.
AUTO OPEN and SET AUTOORDER should be working.Define at FUNCTION ListIndex() the indexes. They will be opened with SET INDEX TO INDEX1, INDEX2, INDEX3... if SET AUTOPEN is OFF.
Can you supply code?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.
What do you mean?DbCreate now needs to pass some extra parameeters with ;. Once the above function is created, DBcreate should work as ordinary in DBFCDX:
Whats the error ? and Whats the version?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 )
What is that function line doing ?Called from: .\source\classes\DATABASE.PRG => ORDERTAGINFO( 1258 )
Code: Select all
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