Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

cannot get field type with dbfieldinfo()

Status
Not open for further replies.

mustis01

Technical User
Jul 6, 2011
2
NL
Hello, im a beginning programmer and my boss wants me to find a way to display the type of a certain field in a database.
It sounded simple enough, but now im stuck.

i tried it with dbfieldinfo(dbs_type, n) but it expects a variable (dbs_type)while the norton guide is talking about constants, in this case DBS_TYPE to get the type of a field.
also, the #include Dbstruct.ch gives me TYPEFLD.PRG(6) Fatal C3008 Bad filename in #include

this is what i have so far:

*field type of a db field
*
set century on
set date to british
clear
#include Dbstruct.ch
*
use artikel3
index on omschrijf to o_omschr
set index to o_omschr
go top
*
t_type = dbfieldinfo(dbs_type, 2)
@9,20 say t_type
close databases
return

maybe it has something to do with the include not working..

thanks in advance



 
seems type() does the same, only problem is that it probably only sees the first record.
this is what i got for now..


set century on
set date to british
set cursor off
clear
*
use artikel3
go top
n_veld = 0
c_col = ""
einde = ""
do while .not. upper(str(n_veld)) = "E"
@10,8 say "vul nr in" get n_veld picture(3)
read
dbgoto(n_veld) //dit moet anders
clear
@15,8 say "totaal aantal records: "
@15,35 say reccount()
*
@16,8 say "kolom nr: "
@16,35 say recno()
*
@17,8 say "kolom naam: "
@17,35 say trim(field(n_veld))
c_col = fieldname(n_veld)
*
@18,8 say "veld nr: "
@18,35 say fieldpos(c_col)
*
@19,8 say "veld inhoud: "
@19,35 say fieldget(fieldpos(c_col))
*
@20,8 say "veld type : "
*@21,35 say type(fieldname(n_veld))
c_type = type(fieldname(n_veld))
do case
case c_type = upper("N")
@20,35 say "nummeriek"
case c_type = "C"
@20,35 say "karakter"
case c_type = "L"
@20,35 say "logisch "
case c_type = "D"
@20,35 say "datum "
endcase
enddo
close databases
return
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top