阅读更多
[code="python"]TreeViewItem cdItem
tv_1.GetItem(handle,cdItem)
long finded
String tablelabel,tablename
tablelabel = cdItem.Label
if tablelabel "" Then
select count(*)
into:finded
from pbcattbl
where pbt_cmnt = :tablelabel;
select pbt_tnam
into:tablename
from pbcattbl
where pbt_cmnt = :tablelabel;
if finded = 0 Then
select count(*)
into:finded
from pbcattbl
where pbt_tnam = :tablelabel;
tablename = tablelabel
end if
if finded >= 1 Then
string ls_syntax,ls_sql,ls_error,colname,collabel
long ls_rowcount,i
//查找要显示的字段
ls_sql ="SELECT pbc_cnam,pbc_cmnt FROM pbcatcol where pbc_tnam = '"+tablename+"'"
ls_syntax =sqlca.syntaxfromsql(ls_sql, ' ',ls_error)
if len(ls_error)>0 then messagebox("错误",ls_error)
dw_3.create(ls_syntax,ls_error)
if len(ls_error)>0 then messagebox("错误",ls_error)
dw_3.settransobject(sqlca)
dw_3.retrieve()
ls_rowcount = dw_3.RowCount()
ls_sql ="SELECT "
for i = 1 to ls_rowcount
ls_sql= ls_sql + dw_3.GetItemString(i,1)
if i ls_rowcount Then
ls_sql = ls_sql + ","
end if
next
ls_sql = ls_sql + " FROM "+tablename
ls_syntax =sqlca.syntaxfromsql(ls_sql, ' ',ls_error)
if len(ls_error)>0 then messagebox("错误",ls_error)
dw_1.create(ls_syntax,ls_error)
if len(ls_error)>0 then messagebox("错误",ls_error)
*/
dw_1.settransobject(sqlca)
dw_1.modify("IF(MOD(GETROW(),2)=0,RGB(192, 192, 192), RGB(255, 255, 255))")
dw_1.retrieve()
//THIS.PostEvent("ue_postopen")
else
MessageBox("错误","数据库中没有该表")
end if
end if