public void InsertfilePath(string path, string innerTxt, int fileType, int file_status) { string sql = "insert into FilePath (filePath,innerTxt,fileType,file_status,file_CreateTime) values ('" + path + "'" + ",'" + innerTxt + "','" + fileType + "','" + file_status + "','" + DateTime.Now + "')"; ISql <SqlCommand, SqlConnection> mysql = new MsSql(); mysql.run(sql, mysql.getInsert); }
public void InsertSql(int fileType) { string sql = "insert into errorpath (error_path,error_type,error_CreateTime) values ('" + URL + "','" + fileType + "','" + DateTime.Now + "')"; ISql <SqlCommand, SqlConnection> mysql = new MsSql(); mysql.run(sql, mysql.getInsert); }
/// <summary> /// 更新文件状态 /// file_status 0 未操作 /// 1 已操作 2 操作出错 /// </summary> /// <param name="path">路径</param> /// <param name="filetype">类型</param> /// <param name="file_status">状态</param> public static void UpdatefilePath(string path, int filetype, int file_status) { string sql = "update filepath set file_status =" + file_status + " ,file_updatetime = '" + DateTime.Now + "' where filepath= '" + path + "' and filetype = " + filetype; ISql <SqlCommand, SqlConnection> mysql = new MsSql(); mysql.run(sql, mysql.getUpdate); }
/// <summary> /// 从数据库读入list /// type 1 目录 /// 2 文件 /// file_status 0 未操作 和操作失败的 /// 1 已经操作 /// 2 操作失败 /// 其他 其他 /// </summary> /// <param name="type">读取类型</param> /// <param name="file_status">读取类型</param> /// <returns></returns> public static List <string> ReadPathByMySQL(int type, int file_status) { string sql = "select distinct filepath from filepath where filetype= " + type.ToString() + " and file_status in ( " + (file_status == 0?"0,2":(file_status == 1?"1":"0,1,2")) + ")"; ISql <SqlCommand, SqlConnection> mysql = new MsSql(); mysql.run(sql, mysql.getListBysql); return(mysql.pathList); }