Jump to content
Fivewin Brasil

Criar uma Tabela usando Table Classe Syntax


kapiaba

Recommended Posts

Vivendo e aprendendo... Show() de bola...



#include "FiveWin.ch"
#include 'ttable.ch'

request Dbfcdx

PROCEDURE main

LOCAL x := 1
LOCAL oTable := nil

RDDSETDEFAULT( 'dbfcdx')

doData()

/*Open An Table With Table Class */
DEFINE TABLE oTable FILE tsttable NEW

/*Adding an Index to This Table */
DEFINE ORDER ON KEY "nome" TAG _1 IN oTable

/* Force the index Creating*/
oTable:Reindex()

WHILE x <= 100

oTable:ReadBlank()

oTable:name := Str( x, 20 )
oTable:street := Str( x + 1, 20 )
oTable:city := Str( x + 2, 20 )
oTable:code := x
oTable:today := Date()
oTable:pay := ( x % 2 ) == 0

oTable:Append()

oTable:Write()

x ++

ENDDO

USE

RETURN

PROCEDURE dodata()

LOCAL oTable

IF !FILE( 'tsttable.dbf' )

/* Criar uma Tabela usando Table Classe Syntax */
/* Create An Table using Table Classe Syntax */
CREATE DATABASE oTable FILE tsttable.dbf

FIELD NAME name TYPE CHARACTER LEN 40 DEC 0 OF oTable
FIELD NAME street TYPE CHARACTER LEN 40 DEC 0 OF oTable
FIELD NAME city TYPE CHARACTER LEN 40 DEC 0 OF oTable
FIELD NAME code TYPE NUMERIC LEN 5 DEC 0 OF oTable
FIELD NAME today TYPE DATE LEN 8 DEC 0 OF oTable
FIELD NAME pay TYPE LOGICAL LEN 1 DEC 0 OF oTable

BUILD TABLE oTable

ENDIF

RETURN


Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...