private string GetFullPathCacheContent(string Key) { if (string.IsNullOrEmpty(this.mCacheFolder)) { throw new Exception("CacheFolder 값이 없습니다"); } string FullPathTemp = ""; if (this.mUseAdo) { string FullPathCache = GetFullPathCacheRs(Key); //Remove 메쏘드로 삭제하다 더 이상 행이 없으면 파일 자체가 삭제됨 if (!File.Exists(FullPathCache)) { return(""); } Recordset Rs = new Recordset(); Rs.Open(FullPathCache, Missing.Value, CursorTypeEnum.adOpenStatic, LockTypeEnum.adLockPessimistic, -1); string Criteria = "Key = '" + Key.Replace("'", "''") + "'"; Rs.Find(Criteria, 0, SearchDirectionEnum.adSearchForward, Missing.Value); if (Rs.EOF) { Rs.Close(); return(""); } FullPathTemp = CFile.GetTempFileName(); CAdo.GetFileFromField(Rs.Fields["Content"], FullPathTemp); } else { string FullPathCache = GetFullPathCacheDt(Key); //Remove 메쏘드로 삭제하다 더 이상 행이 없으면 파일 자체가 삭제됨 if (!File.Exists(FullPathCache)) { return(""); } DataTable dt = new DataTable(); dt.ReadXml(FullPathCache); string Criteria = "Key = '" + Key.Replace("'", "''") + "'"; DataRow[] adr = dt.Select(Criteria); if (adr.Length == 0) { dt = null; return(""); } DataRow dr = adr[0]; FullPathTemp = CFile.GetTempFileName(); CFile.WriteByteToFile(FullPathTemp, (byte[])dr["Content"]); } return(FullPathTemp); }
public static ADODB.Recordset ConvertToRecordset(DataTable dt) { ADODB.Recordset rs = new ADODB.Recordset(); rs.CursorLocation = ADODB.CursorLocationEnum.adUseClient; ADODB.Fields RsFld = rs.Fields; System.Data.DataColumnCollection DtCols = dt.Columns; foreach (DataColumn DtCol in DtCols) { RsFld.Append(DtCol.ColumnName , CAdo.ConvertDotNetTypeToAdoType(DtCol.DataType) , DtCol.MaxLength , DtCol.AllowDBNull ? ADODB.FieldAttributeEnum.adFldIsNullable : ADODB.FieldAttributeEnum.adFldUnspecified , null); } rs.Open(System.Reflection.Missing.Value , System.Reflection.Missing.Value , ADODB.CursorTypeEnum.adOpenStatic , ADODB.LockTypeEnum.adLockOptimistic, 0); foreach (DataRow dr in dt.Rows) { rs.AddNew(System.Reflection.Missing.Value, System.Reflection.Missing.Value); for (int cl = 0; cl < DtCols.Count; cl++) { RsFld[cl].Value = dr[cl]; } } return(rs); }