原創|使用教程|編輯:龔雪|2015-11-02 14:59:15.000|閱讀 329 次
概述:關于Barcode Professional for ASP.NET的使用教程,如何將條碼圖像保存到數據庫或者XML文件。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
相關鏈接:
Barcode Professional里面有個專門的獲取條碼圖像的方法,該方法可以用數組字節來表示條碼圖像生成,因此我們可以調用這種方法來將條碼圖像保存到數據庫中或者XML文件。
在下面的示例中,我們將創建一個ASP.NET的Web應用程序,該應用可以通過DataSet對象把條碼圖像保存到XML文件。
步驟:
'Set the value to encode BarcodeProfessional1.Code = TextBox1.Text 'Create a DataSet and save the barcode image Dim ds As DataSet = New DataSet("MyDataSet") Dim dt As DataTable = New DataTable("MyTable") ds.Tables.Add(dt) 'Create a column to hold the barcode image Dim dc As DataColumn = New DataColumn("BarcodeImage", GetType(Byte())) dt.Columns.Add(dc) 'Create a new row Dim dr As DataRow = dt.NewRow() 'Save the barcode image dr("BarcodeImage") = BarcodeProfessional1.GetBarcodeImage(System.Drawing.Imaging.ImageFormat.Gif) dt.Rows.Add(dr) 'Show the DataSet content Literal1.Text = Server.HtmlEncode(ds.GetXml()) Panel1.Visible = True
//Set the value to encode BarcodeProfessional1.Code = TextBox1.Text; //Create a DataSet and save the barcode image DataSet ds = new DataSet("MyDataSet"); DataTable dt = new DataTable("MyTable"); ds.Tables.Add(dt); //Create a column to hold the barcode image DataColumn dc = new DataColumn("BarcodeImage", typeof(byte[])); dt.Columns.Add(dc); //Create a new row DataRow dr = dt.NewRow(); //Save the barcode image dr["BarcodeImage"] = BarcodeProfessional1.GetBarcodeImage(System.Drawing.Imaging.ImageFormat.Gif); dt.Rows.Add(dr); //Show the DataSet content Literal1.Text = Server.HtmlEncode(ds.GetXml()); Panel1.Visible = true;
運行創建的ASP.NET Web應用程序,你將看到以下輸出
本站文章除注明轉載外,均為本站原創或翻譯。歡迎任何形式的轉載,但請務必注明出處、不得修改原文相關鏈接,如果存在內容上的異議請郵件反饋至chenjj@fc6vip.cn