如何用C 將資料庫中的記錄製成XML

2021-03-31 08:56:58 字數 1643 閱讀 9032

以前在乙個公司專案中要用資料庫中的記錄生成相應的xml檔案[主要是為了提高訪問速度],但由於當時資料的缺乏,在開發過程中遇到了不過的困難,好在最終完成了工作,我在這裡把當時其中的乙個功能函式列出來,其於的函式大同小意,希望兄弟們以後在遇到這樣的問題時不象我當初一樣再吃苦頭.

using system;

using system.collections;

using system.***ponentmodel;

using system.data;

using system.diagnostics;

using system.web;

using system.web.services;

using system.xml;

using system.data.sqlclient;

using system.configuration;

using system.text;

using system.xml.xsl;

using system.io;

namespace admin

#region 元件設計器生成的**

//web 服務設計器所必需的

private icontainer ***ponents = null;

///

/// 設計器支援所需的方法 - 不要使用**編輯器修改

/// 此方法的內容。

///

private void initialize***ponent()

///

/// 清理所有正在使用的資源。

///

protected override void dispose( bool disposing )

base.dispose(disposing);  

}#endregion

picxmlwriter.writestartelement("","height","");

picxmlwriter.writestring(picstr[1].trim().trim());

picxmlwriter.writeendelement();

picxmlwriter.writestartelement("","width","");

picxmlwriter.writestring(picstr[1].trim().trim());

picxmlwriter.writeendelement();

picxmlwriter.writestartelement("","***ment","");

picxmlwriter.writestring(pic[++i].trim().trim());

picxmlwriter.writeendelement();

picxmlwriter.writeendelement();

}else

}picxmlwriter.writeendelement();}}

picxmlwriter.writeendelement();

}picxmlwriter.writeendelement();

picxmlwriter.flush();

}catch (exception e)

", e.tostring());

}

如何用C 來部署資料庫續

在前一篇 如何用c 來部署資料庫 中寫到的方法本身還有乙個問題,就是如果資料庫指令碼中含有storeprocedure的話,我給出的方法就無法執行,然後我再原有的基礎上,作了如下修改,既能滿足以前的指令碼執行,也能完成含有storeprocedure指令碼的執行。大致的修改是替換原先的created...

轉貼 如何用C 壓縮access資料庫

c 壓縮access檔案 因為自己的空間服務商上傳檔案有大小限制,我怕以後資料庫太大了無法拉下來壓縮,在網上找到以下解決方法 先引用com microsoft jet and replication objects x.x library string strs provider microsoft...

C 中如何將檔案位址存入資料庫

其實想要更概括的講,應該是 c 中怎樣將含有有 的字串存入資料庫中 這裡只是我在寫乙個軟體過程中,是需要將檔案的路徑 肯定包含有 了 存入我的mysql資料庫,順便就引發了這個問題.開始還是花了點時間,既然完成了,還是記錄下.只是為了拋磚引玉的說明問題,就不新建乙個專案完完全全的講了.if stri...