在主程序加入一句on shutdown do p_exit注:p_exit的形式可以是 p_exit.prg ,也可以是个自定义过程p_exitp_exit的内容例如if type('your_connection')='N' if your_connection >0 sqldisconnect(your_connection) on shutdown endifendifclear eventquit