/// <summary> /// 判断指定文件类型是否存在,不存在时执行后续操作 /// </summary> /// <param name="documentName"></param> /// <returns></returns> public static bool ExistsFileExtension(string documentName) { string sql; string fileExtension; fileExtension = Path.GetExtension(documentName).Substring(1); try { //增加新的文件类型 sql = "select * from SA_FileExtension where Extension='" + fileExtension + "'"; return(BaseSQL.Exists(sql)); } catch (Exception ex) { ExceptionHandler.HandleException("判断指定文件类型是否存在错误。", ex); return(false); } }
/// <summary> /// 判断指定文件类型是否存在,不存在时执行后续操作 /// </summary> /// <param name="documentName"></param> /// <returns></returns> public static bool ExistsFileExtension(string documentName) { string sql; string fileExtension; fileExtension = Path.GetExtension(documentName).Substring(1); try { //增加新的文件类型 sql = "select * from SA_FileExtension where Extension='" + fileExtension + "'"; return(BaseSQL.Exists(sql)); } catch (Exception ex) { MessageBox.Show(ex.Message, f.tsmiTs.Text, MessageBoxButtons.OK, MessageBoxIcon.Information); return(false); } }