private string method_0(object object_0) { if (object_0 is DBNull) { return(""); } IMemoryBlobStream o = object_0 as IMemoryBlobStream; IPropertySet set = new PropertySetClass(); IObjectStream pstm = new ObjectStreamClass { Stream = o }; IPersistStream stream3 = set as IPersistStream; stream3.Load(pstm); string str2 = ""; try { str2 = set.GetProperty("TK").ToString(); } catch (Exception) { } ComReleaser.ReleaseCOMObject(stream3); ComReleaser.ReleaseCOMObject(set); ComReleaser.ReleaseCOMObject(o); set = null; return(str2); }
/// <summary> /// 获取要素行中指定字段索引的值,该函数抛出异常 /// </summary> /// <param name="pRow">要素行</param> /// <param name="sField">字段</param> /// <param name="value">返回值</param> public static void GetFieldValue(IRow pRow, string sField, ref IMemoryBlobStream value) { object obj = GetFieldValue(pRow, sField); Debug.Assert(obj != null); value = obj as IMemoryBlobStream; }
private void CopyConfigXml(string Settingname, string SettingPath) { try { SysGisTable mSystable = new SysCommon.Gis.SysGisTable(Plugin.ModuleCommon.TmpWorkSpace); Exception err = null; Dictionary <string, object> pDic = mSystable.GetRow("SYSSETTING", "SETTINGNAME='" + Settingname + "'", out err); if (pDic != null) { if (pDic.ContainsKey("SETTINGVALUE2")) { if (pDic["SETTINGVALUE2"] != null) //这里仅能成功导出当初以文件类型导入的BLOB字段 { object tempObj = pDic["SETTINGVALUE2"]; IMemoryBlobStreamVariant pMemoryBlobStreamVariant = tempObj as IMemoryBlobStreamVariant; IMemoryBlobStream pMemoryBlobStream = pMemoryBlobStreamVariant as IMemoryBlobStream; if (pMemoryBlobStream != null) { pMemoryBlobStream.SaveToFile(SettingPath); } } } } } catch (Exception err2) { } }
public FrmStatisticsConfig(IWorkspace pTmpWorkSpace) { _TmpWorkSpace = pTmpWorkSpace; if (pTmpWorkSpace != null) { SysCommon.ModSysSetting.CopyLayerTreeXmlFromDataBase(pTmpWorkSpace, _LayerTreePath); SysGisTable mSystable = new SysCommon.Gis.SysGisTable(pTmpWorkSpace); Exception err = null; Dictionary <string, object> pDic = mSystable.GetRow("SYSSETTING", "SETTINGNAME='统计配置'", out err); if (pDic != null) { if (pDic.ContainsKey("SETTINGVALUE2")) { if (pDic["SETTINGVALUE2"] != null) //这里仅能成功导出当初以文件类型导入的BLOB字段 { object tempObj = pDic["SETTINGVALUE2"]; IMemoryBlobStreamVariant pMemoryBlobStreamVariant = tempObj as IMemoryBlobStreamVariant; IMemoryBlobStream pMemoryBlobStream = pMemoryBlobStreamVariant as IMemoryBlobStream; if (pMemoryBlobStream != null) { try { pMemoryBlobStream.SaveToFile(_QueryConfigPath); } catch { return; } } } } } } InitializeComponent(); }
private IElement method_1(object object_1) { if (object_1 is DBNull) { return(null); } IMemoryBlobStream o = object_1 as IMemoryBlobStream; IPropertySet set = new PropertySetClass(); IObjectStream pstm = new ObjectStreamClass { Stream = o }; IPersistStream stream3 = set as IPersistStream; stream3.Load(pstm); IElement property = null; try { property = set.GetProperty("Element") as IElement; } catch (Exception) { } ComReleaser.ReleaseCOMObject(stream3); ComReleaser.ReleaseCOMObject(set); ComReleaser.ReleaseCOMObject(o); set = null; return(property); }
/// <summary> /// 修改更新游标中行的数据 /// </summary> /// <param name="pUpdateRow">需要特别说明的是[pUpdateRow(必须使用GetUpdateRow函数获得行接口)]</param> /// <param name="sField">字段</param> /// <param name="value">值</param> public static void SetFieldValue(IRow pUpdateRow, string sField, IMemoryBlobStream value) { IFields pFields = pUpdateRow.Fields; int index = pFields.FindField(sField); SetFieldValue(pUpdateRow, index, value); }
public static void CopyConfigXml(IWorkspace pWks, string Settingname, string SettingPath) { try { SysGisTable mSystable = new Fan.Common.Gis.SysGisTable(pWks); Exception err = null; Dictionary <string, object> pDic = mSystable.GetRow("SYSSETTING", "SETTINGNAME='" + Settingname + "'", out err); if (pDic != null) { if (pDic.ContainsKey("SETTINGVALUE2")) { if (pDic["SETTINGVALUE2"] != null) //这里仅能成功导出当初以文件类型导入的BLOB字段 { object tempObj = pDic["SETTINGVALUE2"]; IMemoryBlobStreamVariant pMemoryBlobStreamVariant = tempObj as IMemoryBlobStreamVariant; IMemoryBlobStream pMemoryBlobStream = pMemoryBlobStreamVariant as IMemoryBlobStream; if (pMemoryBlobStream != null) { pMemoryBlobStream.SaveToFile(SettingPath); } } } } mSystable = null; if (pDic != null) { pDic.Clear(); pDic = null; } } catch (Exception err2) { } }
private IElement method_2(object object_0) { IMemoryBlobStream o = object_0 as IMemoryBlobStream; IPropertySet set = new PropertySetClass(); IObjectStream pstm = new ObjectStreamClass { Stream = o }; ESRI.ArcGIS.esriSystem.IPersistStream stream3 = set as ESRI.ArcGIS.esriSystem.IPersistStream; stream3.Load(pstm); IElement property = null; try { property = set.GetProperty("Element") as IElement; } catch (Exception) { } ComReleaser.ReleaseCOMObject(stream3); ComReleaser.ReleaseCOMObject(set); ComReleaser.ReleaseCOMObject(o); set = null; return(property); }
private void SaveBookmarkDatFile(string filePath, ISceneBookmarks _SceneBookmarks) { try { IObjectStream pObjStream = new ObjectStreamClass(); _SceneBookmarks.SaveBookmarks(pObjStream.Stream); IMemoryBlobStream pMemBlobStream = pObjStream.Stream as IMemoryBlobStream; pMemBlobStream.SaveToFile(filePath); } catch { } }
//从数据库向本地拷贝 private void CopyEagleEyeMap(IWorkspace pWorkspace, string strPath) { Exception eError = null; //读取数据库表内容 object tempObj = GetFieldValue("SYSSETTING", "SETTINGVALUE2", "SETTINGNAME='鹰眼图'", pWorkspace, out eError); IMemoryBlobStreamVariant pMemoryBlobStreamVariant = tempObj as IMemoryBlobStreamVariant; IMemoryBlobStream pMemoryBlobStream = pMemoryBlobStreamVariant as IMemoryBlobStream; if (pMemoryBlobStream != null) { pMemoryBlobStream.SaveToFile(strPath); } }
private void btn_DownLoad_Click(object sender, EventArgs e) { SaveFileDialog sfd; if (this.xtraTabControl1.SelectedTabPageIndex == 0) { DataRow dr = gridView2.GetFocusedDataRow(); string fileName = dr["文件名称"].ToString(); string fileType = fileName.Substring(fileName.LastIndexOf('.')); if (_dictCad.ContainsKey(fileName)) { object fileCad = _dictCad[fileName]; sfd = new SaveFileDialog(); sfd.RestoreDirectory = true; sfd.Filter = "保存文件|*" + fileType; if (sfd.ShowDialog() == DialogResult.OK) { IMemoryBlobStream mbs = fileCad as IMemoryBlobStream; if (mbs == null) { return; } mbs.SaveToFile(sfd.FileName); } } } else { DataRow dr = gridView1.GetFocusedDataRow(); string fileName = dr["文件名称"].ToString(); string fileType = dr["文件类别"].ToString(); if (_dictFiles.ContainsKey(fileName)) { object file = _dictFiles[fileName]; sfd = new SaveFileDialog(); sfd.RestoreDirectory = true; sfd.Filter = "保存文件|*" + fileType; if (sfd.ShowDialog() == DialogResult.OK) { IMemoryBlobStream mbs = file as IMemoryBlobStream; if (mbs == null) { return; } mbs.SaveToFile(sfd.FileName); } } } }
//当初当前系统参数的值,放在指定路径(限定该参数值是BLOB类型,并且存入时是选取文件存入的) private void buttonXExport_Click(object sender, EventArgs e) { if (!comboBoxDataType.Text.Contains("File")) { return; } SaveFileDialog pOpenFileDlg = new SaveFileDialog(); pOpenFileDlg.Title = "选择文件"; switch (comboBoxDataType.Text) { case "XmlFile": //弹出对话框供用户设置导出的xml文件 pOpenFileDlg.Filter = "XML数据(*.xml)|*.xml"; break; case "MxdFile": pOpenFileDlg.Filter = "mxd文件(*.mxd)|*.mxd"; break; } if (pOpenFileDlg.ShowDialog() == DialogResult.OK) { //获得系统参数表的BLOB字段值,并导出到指定文件中 string strPath = pOpenFileDlg.FileName; SysGisTable mSystable = new SysCommon.Gis.SysGisTable(_TmpWorkSpace); Exception err = null; Dictionary <string, object> pDic = mSystable.GetRow("SYSSETTING", "SETTINGNAME='" + this.textBoxSettingName.Text + "'", out err); if (pDic != null) { if (pDic.ContainsKey("SETTINGVALUE2")) { if (pDic["SETTINGVALUE2"] != null) //这里仅能成功导出当初以文件类型导入的BLOB字段 { object tempObj = pDic["SETTINGVALUE2"]; IMemoryBlobStreamVariant pMemoryBlobStreamVariant = tempObj as IMemoryBlobStreamVariant; IMemoryBlobStream pMemoryBlobStream = pMemoryBlobStreamVariant as IMemoryBlobStream; if (pMemoryBlobStream != null) { pMemoryBlobStream.SaveToFile(strPath); MessageBox.Show("将文件" + strPath + "导出成功", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);//ygc 2012-12-17 新增提示信息 } } } } mSystable = null; } }
private IPropertySet method_3(object object_1) { if (object_1 is DBNull) { return(null); } IMemoryBlobStream o = object_1 as IMemoryBlobStream; IPropertySet set2 = new PropertySetClass(); IObjectStream pstm = new ObjectStreamClass { Stream = o }; (set2 as IPersistStream).Load(pstm); ComReleaser.ReleaseCOMObject(o); return(set2); }
public static object GetBlobValue(this IActiveRecord wrapper, FieldAttribute attribute) { IMemoryBlobStream blobStream = wrapper.UnderlyingObject.get_Value(attribute.Index) as IMemoryBlobStream; if (blobStream == null) { return(null); } IObjectStream stream = new ObjectStreamClass() { Stream = blobStream }; IPersistStream blob = new PropertySetClass(); blob.Load(blobStream); return(blob as IPropertySet); }
public static bool CopySysSettingtoFile(IWorkspace pWorkspace, string strSettingName, string strPath) { Exception eError = null; if (pWorkspace != null) { try { //读取数据库表内容 Fan.Common.Gis.SysGisTable sysTable = new Fan.Common.Gis.SysGisTable(pWorkspace); Exception err = null; Dictionary <string, object> pDic = sysTable.GetRow("SYSSETTING", "SETTINGNAME='" + strSettingName + "'", out err); if (pDic != null) { if (pDic.ContainsKey("SETTINGVALUE2")) { if (pDic["SETTINGVALUE2"] != null) //这里仅能成功导出当初以文件类型导入的BLOB字段 { object tempObj = pDic["SETTINGVALUE2"]; IMemoryBlobStreamVariant pMemoryBlobStreamVariant = tempObj as IMemoryBlobStreamVariant; IMemoryBlobStream pMemoryBlobStream = pMemoryBlobStreamVariant as IMemoryBlobStream; if (pMemoryBlobStream != null) { pMemoryBlobStream.SaveToFile(strPath); } sysTable = null; return(true); } } } sysTable = null; } catch (Exception err) {} } return(false); }
public static void TestThumbnailBuilder(string rasterTypeName, string rasterTypeProductFilter, string rasterTypeProductName, string dataSource, string dataSourceFilter, string fgdbParentFolder, bool saveToArt, string customTypeFilePath, bool clearGdbDirectory) { try { string[] rasterProductNames = rasterTypeProductName.Split(';'); string nameString = rasterTypeName.Replace(" ", "") + rasterTypeProductFilter.Replace(" ", "") + rasterProductNames[0].Replace(" ", ""); #region Directory Declarations string fgdbName = nameString + ".gdb"; string fgdbDir = fgdbParentFolder + "\\" + fgdbName; string MosaicDatasetName = nameString + "MD"; #endregion #region Global Declarations IMosaicDataset theMosaicDataset = null; IMosaicDatasetOperation theMosaicDatasetOperation = null; IMosaicWorkspaceExtensionHelper mosaicExtHelper = null; IMosaicWorkspaceExtension mosaicExt = null; #endregion #region Create File GDB Console.WriteLine("Creating File GDB: " + fgdbName); if (clearGdbDirectory) { try { Console.WriteLine("Emptying Gdb folder."); System.IO.Directory.Delete(fgdbParentFolder, true); System.IO.Directory.CreateDirectory(fgdbParentFolder); } catch (System.IO.IOException EX) { Console.WriteLine(EX.Message); return; } } // Create a File Gdb Type factoryType = Type.GetTypeFromProgID("esriDataSourcesGDB.FileGDBWorkspaceFactory"); IWorkspaceFactory FgdbFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType); FgdbFactory.Create(fgdbParentFolder, fgdbName, null, 0); #endregion #region Create Mosaic Dataset try { Console.WriteLine("Create Mosaic Dataset: " + MosaicDatasetName); // Setup workspaces. IWorkspaceFactory workspaceFactory = (IWorkspaceFactory)Activator.CreateInstance(factoryType); IWorkspace fgdbWorkspace = workspaceFactory.OpenFromFile(fgdbDir, 0); // Create Srs ISpatialReferenceFactory spatialrefFactory = new SpatialReferenceEnvironmentClass(); ISpatialReference mosaicSrs = spatialrefFactory.CreateProjectedCoordinateSystem( (int)(esriSRProjCSType.esriSRProjCS_World_Mercator)); // Create the mosaic dataset creation parameters object. ICreateMosaicDatasetParameters creationPars = new CreateMosaicDatasetParametersClass(); // Create the mosaic workspace extension helper class. mosaicExtHelper = new MosaicWorkspaceExtensionHelperClass(); // Find the right extension from the workspace. mosaicExt = mosaicExtHelper.FindExtension(fgdbWorkspace); // Use the extension to create a new mosaic dataset, supplying the // spatial reference and the creation parameters object created above. theMosaicDataset = mosaicExt.CreateMosaicDataset(MosaicDatasetName, mosaicSrs, creationPars, ""); theMosaicDatasetOperation = (IMosaicDatasetOperation)(theMosaicDataset); } catch (Exception exc) { Console.WriteLine("Error: Failed to create Mosaic Dataset : {0}.", MosaicDatasetName + " " + exc.Message); return; } #endregion #region Create Custom Raster Type Console.WriteLine("Preparing Raster Type"); // Create a Raster Type Name object. IRasterTypeName theRasterTypeName = new RasterTypeNameClass(); // Assign the name of the Raster Type to the name object. // The Name field accepts a path to an .art file as well // the name for a built in Raster Type. theRasterTypeName.Name = rasterTypeName; // Use the Open function from the IName interface to get the Raster Type object. IRasterType theRasterType = (IRasterType)(((IName)theRasterTypeName).Open()); if (theRasterType == null) { Console.WriteLine("Error:Raster Type not found " + rasterTypeName); return; } #endregion #region Prepare Raster Type // Set the URI Filter on the loaded raster type. if (rasterTypeProductFilter != "") { // Get the supported URI filters from the raster type object using the // raster type properties interface. IArray mySuppFilters = ((IRasterTypeProperties)theRasterType).SupportedURIFilters; IItemURIFilter productFilter = null; for (int i = 0; i < mySuppFilters.Count; ++i) { // Set the desired filter from the supported filters. productFilter = (IItemURIFilter)mySuppFilters.get_Element(i); if (productFilter.Name == rasterTypeProductFilter) { theRasterType.URIFilter = productFilter; } } } // Enable the correct templates in the raster type. bool enableTemplate = false; if (rasterProductNames.Length >= 1 && (rasterProductNames[0] != "")) { // Get the supported item templates from the raster type. IItemTemplateArray templateArray = theRasterType.ItemTemplates; for (int i = 0; i < templateArray.Count; ++i) { // Go through the supported item templates and enable the ones needed. IItemTemplate template = templateArray.get_Element(i); enableTemplate = false; for (int j = 0; j < rasterProductNames.Length; ++j) { if (template.Name == rasterProductNames[j]) { enableTemplate = true; } } if (enableTemplate) { template.Enabled = true; } else { template.Enabled = false; } } } ((IRasterTypeProperties)theRasterType).DataSourceFilter = dataSourceFilter; #endregion #region Save Custom Raster Type if (saveToArt) { IRasterTypeProperties rasterTypeProperties = (IRasterTypeProperties)theRasterType; IRasterTypeEnvironment rasterTypeHelper = new RasterTypeEnvironmentClass(); rasterTypeProperties.Name = customTypeFilePath; IMemoryBlobStream ipBlob = rasterTypeHelper.SaveRasterType(theRasterType); ipBlob.SaveToFile(customTypeFilePath); } #endregion #region Preparing Data Source Crawler Console.WriteLine("Preparing Data Source Crawler"); // Create a new property set to specify crawler properties. IPropertySet crawlerProps = new PropertySetClass(); // Specify a file filter crawlerProps.SetProperty("Filter", dataSourceFilter); // Specify whether to search subdirectories. crawlerProps.SetProperty("Recurse", true); // Specify the source path. crawlerProps.SetProperty("Source", dataSource); // Get the recommended crawler from the raster type based on the specified // properties using the IRasterBuilder interface. // Pass on the Thumbnailtype to the crawler... IDataSourceCrawler theCrawler = ((IRasterBuilder)theRasterType).GetRecommendedCrawler(crawlerProps); #endregion #region Add Rasters try { Console.WriteLine("Adding Rasters"); // Create a AddRaster parameters object. IAddRastersParameters AddRastersArgs = new AddRastersParametersClass(); // Specify the data crawler to be used to crawl the data. AddRastersArgs.Crawler = theCrawler; // Specify the Thumbnail raster type to be used to add the data. AddRastersArgs.RasterType = theRasterType; // Use the mosaic dataset operation interface to add // rasters to the mosaic dataset. theMosaicDatasetOperation.AddRasters(AddRastersArgs, null); } catch (Exception ex) { Console.WriteLine("Error: Add raster Failed." + ex.Message); return; } #endregion #region Compute Pixel Size Ranges Console.WriteLine("Computing Pixel Size Ranges."); try { // Create a calculate cellsize ranges parameters object. ICalculateCellSizeRangesParameters computeArgs = new CalculateCellSizeRangesParametersClass(); // Use the mosaic dataset operation interface to calculate cellsize ranges. theMosaicDatasetOperation.CalculateCellSizeRanges(computeArgs, null); } catch (Exception ex) { Console.WriteLine("Error: Compute Pixel Size Failed." + ex.Message); return; } #endregion #region Building Boundary Console.WriteLine("Building Boundary"); try { // Create a build boundary parameters object. IBuildBoundaryParameters boundaryArgs = new BuildBoundaryParametersClass(); // Set flags that control boundary generation. boundaryArgs.AppendToExistingBoundary = true; // Use the mosaic dataset operation interface to build boundary. theMosaicDatasetOperation.BuildBoundary(boundaryArgs, null); } catch (Exception ex) { Console.WriteLine("Error: Build Boundary Failed." + ex.Message); return; } #endregion #region Report Console.WriteLine("Successfully created MD: " + MosaicDatasetName + ". "); #endregion } catch (Exception exc) { #region Report Console.WriteLine("Exception Caught in TestThumbnailBuilder: " + exc.Message); Console.WriteLine("Failed."); Console.WriteLine("Shutting down."); #endregion } }
private void ImportProject(string strTableName) { m_dSaveDate = System.DateTime.Now; if (this.m_strProName == null) { XtraMessageBox.Show("请指定需要导入的文件", "导入文件"); return; } try { WaitForm.SetCaption("正在连接数据库,请稍后..."); m_pCurWorkspace = GetWorkSpace(); if (m_pCurWorkspace == null) { return; } m_pTabDocment = (m_pCurWorkspace as IFeatureWorkspace).OpenTable(strTableName); } catch (System.Exception ex) { XtraMessageBox.Show("无法打开表" + strTableName + "请确定数据库中是否存在该表", "导入文件"); WaitForm.Stop(); return; } if (m_pTabDocment == null) { return; } IRow pReportRow = null; string sFPath = ""; try { for (int i = 0; i < m_ArrayListFiles.Count; i++) { m_strFileName = ((FileInfo)m_ArrayListFiles[i]).Name; WaitForm.SetCaption("正在上传" + m_strFileName + "请稍后..."); m_strFileFolder = ((FileInfo)m_ArrayListFiles[i]).Directory.Name; if (!IsExist(FIELD_PRONAME, m_strFileName, m_pTabDocment)) { sFPath = ((FileInfo)m_ArrayListFiles[i]).FullName; m_dCreationDate = ((FileInfo)m_ArrayListFiles[i]).LastWriteTime; IMemoryBlobStream mbs = GetStreamFromFile(sFPath) as IMemoryBlobStream; if (mbs.Size == 0) { XtraMessageBox.Show(Path.GetFileName(sFPath) + " 为空文件", "提示"); return; } //获得文件扩展信息 //ArrayList aDetailedInfo = null; //aDetailedInfo = GetDetailedFileInfo(sFPath); //向数据库中写入记录 pReportRow = m_pTabDocment.CreateRow(); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_PRONAME), m_strProName); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_PRONUM), m_strProNum); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_DESIGN), m_strDesign); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_DESIGNER), m_strDesigner); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_PROJECTDATE), m_strProDate); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_CADNAME), m_strFileName); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_CADFILE), mbs); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_DESIGNPHASE), m_nDesignPhase); pReportRow.Store(); } else { XtraMessageBox.Show(m_strFileName + "已存在", "导入文件"); WaitForm.Stop(); continue; } } } catch (System.Exception ex) { WaitForm.Stop(); } }
private void ImportFile(string strTableName) { m_dSaveDate = System.DateTime.Now; if (this.m_ArrayListFiles == null || this.m_ArrayListFiles.Count == 0) { XtraMessageBox.Show("请指定需要导入的文件", "导入文件"); return; } if (m_strFileClass == null) { XtraMessageBox.Show("资料类型不能为空", "导入文件"); return; } try { WaitForm.SetCaption("正在连接数据库,请稍后..."); m_pCurWorkspace = GetWorkSpace(); if (m_pCurWorkspace == null) { return; } m_pTabDocment = (m_pCurWorkspace as IFeatureWorkspace).OpenTable(strTableName); } catch (System.Exception ex) { XtraMessageBox.Show("无法打开表" + strTableName + "请确定数据库中是否存在该表", "导入文件"); WaitForm.Stop(); return; } if (m_pTabDocment == null) { return; } IRow pReportRow = null; string sFPath = ""; for (int i = 0; i < m_ArrayListFiles.Count; i++) { m_strFileName = ((FileInfo)m_ArrayListFiles[i]).Name; m_strFileType = m_strFileName.Substring(m_strFileName.LastIndexOf('.')); WaitForm.SetCaption("正在上传" + m_strFileName + "请稍后..."); m_strFileFolder = ((FileInfo)m_ArrayListFiles[i]).Directory.Name; if (!IsExist(FIELD_FILENAME, m_strFileName, m_pTabDocment)) { sFPath = ((FileInfo)m_ArrayListFiles[i]).FullName; m_dCreationDate = ((FileInfo)m_ArrayListFiles[i]).LastWriteTime; IMemoryBlobStream mbs = GetStreamFromFile(sFPath) as IMemoryBlobStream; if (mbs.Size == 0) { XtraMessageBox.Show(Path.GetFileName(sFPath) + " 为空文件", "提示"); return; } //获得文件扩展信息 //ArrayList aDetailedInfo = null; //aDetailedInfo = GetDetailedFileInfo(sFPath); //向数据库中写入记录 pReportRow = m_pTabDocment.CreateRow(); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_FILENAME), m_strFileName); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_FILECLASS), m_strFileClass); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_VERSION), m_strFileVersion); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_PROMULGATEDATE), m_strProDate); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_PROMULGATEUNIT), m_strFilePromulgateUnit); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_FILETYPE), m_strFileType); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_DISCRIPTION), m_strDiscription); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_MARK), m_strMark); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_SAVER), m_strFileSaver); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_SAVEDATE), m_dSaveDate); //pReportRow.set_Value(m_pTabDocment.FindField(FIELD_SAVEYEAR), m_dSaveDate.Year); pReportRow.set_Value(m_pTabDocment.FindField(FIELD_OBJFILE), mbs); pReportRow.Store(); } else { XtraMessageBox.Show((m_strFileName + "已存在"), "导入文件"); WaitForm.Stop(); continue; } } }
/// <summary> /// 修改更新游标中行的数据 /// </summary> /// <param name="pUpdateRow">需要特别说明的是[pUpdateRow(必须使用GetUpdateRow函数获得行接口)]</param> /// <param name="index">字段索引</param> /// <param name="value">值</param> public static void SetFieldValue(IRow pUpdateRow, int index, IMemoryBlobStream value) { Debug.Assert(pUpdateRow != null && index > 0 && value != null); pUpdateRow.set_Value(index, value); }