* ----------------------------------------------------------------------- \\ sql_field
m_fields='file_id' && \\ sql语句
m_dbf='sys_file' && \\ 取值的远程表字段
m_while=' file_id=?user_info.photo_id'
PUBLIC m_field
m_field=1
do cx\sql_field
thisform.retu
* ------------------------------------------------------------------------------------------- \\ 取字段变量
* m_sql=m_fields&&+m_dbf+' where '+m_while
m_sql='select '+m_fields+' from '+m_dbf+' where '+m_while
m_retu=0
IF SQLEXEC(gnMyLogHandle,m_sql,'abcde') = -1
m_retu=1
AERROR( laError )
MESSAGEBOX( '读取数据库错误提示:' + ALLTRIM(STR(laError[ 1 ])) + CHR( 13 ) +laError[ 2 ])
ENDIF
STRTOFILE(m_sql ,"c:\sql.TXT")
* ------------------------------------------------------------------------------------------- \\ 检查是否出错
IF m_retu=1
MESSAGEBOX(m_sql)
STRTOFILE(m_sql ,"c:\Error.TXT")
MESSAGEBOX('请注意:系统在【字段值】数据【'+m_name+'】时,发生错误,请检查网络是否畅通或与系统管理员联系!'+m_message,48,m_message1)
RETURN
ENDIF
SELECT abcde
GO top
*m_fields='123,abc,xyz'
m_fields=m_fields+','
z=0
DO whil .t.
z=z+1
zz=ALLTRIM(STR(z))
IF AT(',',m_fields,z)=0
EXIT
ELSE
IF z=1
zzz=SUBSTR(m_fields,1,AT(',',m_fields,z)-1)
m_field=abcde.&zzz
ELSE
zzz=SUBSTR(m_fields,AT(',',m_fields,z-1)+1,AT(',',m_fields,z)-AT(',',m_fields,z-1)-1)
m_field&zz=abcde.&zzz
ENDIF
ENDIF
ENDDO
* m_field=max
USE IN abcde