INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

cannot get field type with dbfieldinfo()

cannot get field type with dbfieldinfo()

(OP)
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



 

RE: cannot get field type with dbfieldinfo()

(OP)
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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close