VFP调用Sql Server的取最大值(通用类)!
* ----------------------------------------------------------------------- \\ sql_max m_dbf="sys_menu" && \\ sql语句 m_name='' m_max=0 m_fields='sort' && \\ 取最大值的字段 m_while='where class=?m_class and bj=?m_bj' m_name='菜单表' DO cx\sql_max thisform.retu
* ------------------------------------------------------------------------------------------- \\ 取最大值类 m_sql='select MAX('+'&m_fields'+') as max from '+m_dbf+' '+m_while m_retu=0 STRTOFILE(m_sql ,"c:\sql.TXT") IF SQLEXEC(gnMyLogHandle,m_sql,'abcde') = -1 m_retu=1 AERROR( laError ) MESSAGEBOX( '读取数据库错误提示:' + ALLTRIM(STR(laError[ 1 ])) + CHR( 13 ) +laError[ 2 ]) ENDIF * ------------------------------------------------------------------------------------------- \\ 检查是否出错 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 m_max=max