General information
Title:
Need table informations to build 'oneforallform'
Hallo everbody !
I have a form which works with different tables in different databases.
(Mysql,SAPDB,Foxpro,MS-SQL)
The idea is that i only have to name the table, the tablekey and the database type in the init event of the form and the form will work with all tables in all databases !!!!
At the beginning i need the table information from the database (fieldnames,dec,len,type,comment ...)
I use this informations:
a) to build a flexible search which offers all fields of the table and search operators depending on the fieldtype (>,<,=,like '%,like '% %')
b) to build an flexible cursor to keep the result of the sql-select commands
c) to build an flexible grid to work with the data (caption,columnwidth,maxlength,current control...)
d) to build flexible insert and update commands
I use the comment of the fields in the table to manage different problems
(updated allowed ?, is this field a date field even if the fieldtype is C (SAP!!)?,
can this field be empty?, do i need a textbox , a optionbox or a combobox in the column of the grid ?)
Everything works well ! I need 2 minutes to create a form for a spezial table in a spezial database !
BUT :
Where is the comment of the field in foxpro ??
Until now i do:
if databasetype = dbf - use (tablename) - copy structure extendet to "alltablefields"
(fieldnames,types,len,dec .... are ok! no fieldcomment !!)
So i have to expand allfieldtables with a new field table_cmt
scan
cinfo = ALLTRIM(tabelname)+"."+field_name
cResults = DBGETPROP((cinfo), "Field", "Comment")
replace table_cmt WITH upper(alltrim(cresults))
endscan
It works, but looks foolish
Is there a better way to retrieve all needed informations !
(in sapdb it just is: select * from columns where tablename = 'mytable' into cursor alltablefields)
Any help welcomed !
Best regards
Albert
Reply
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only