如何生成代码39并存储在db中? (在c#.net中) [英] how to generate code 39 and store in db? (in c#.net)

查看:66
本文介绍了如何生成代码39并存储在db中? (在c#.net中)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

朋友,

我想生成9的代码3,以通过textbox(string)输入.我也想将条形码保存在数据库中.
我下载了条形码字体并安装并尝试了以下代码.

Hi Friend,

I want to generate code 3 of 9 for input through textbox(string). I want to save that barcode in database also.
I downloaded the barcode font and installed and tried the following code.

using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace BarCodes
{
    /// <summary />
    /// Summary description for WebForm1.
    /// </summary />
    public class WebForm1 : System.Web.UI.Page
    {
        protected System.Web.UI.WebControls.Image myBarCode;
    
        private void Page_Load(object sender, System.EventArgs e)
        {
            // Put user code to initialize the page here
            myBarCode.ImageUrl = "BarCode.aspx?code=31231";
        }

        #region Web Form Designer generated code
        override protected void OnInit(EventArgs e)
        {
            //
            // CODEGEN: This call is required by the ASP.NET Web Form Designer.
            //
            InitializeComponent();
            base.OnInit(e);
        }
        
        /// <summary />
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary />
        private void InitializeComponent()
        {    
            this.Load += new System.EventHandler(this.Page_Load);

        }
        #endregion
    }
}


还创建了asp:image对象.但是我遇到了错误.

您能帮我编码吗?
预先感谢,
Saranya


Also created asp:image object.But i''m getting the error.

Can you please help me to code that.
Thanks in advance,
Saranya

推荐答案

您看过这篇文章吗?
C#条形码生成器Web服务 [
Did you have a look at this article?
C# Barcode Generator WebService[^]


using KeepDynamic.Barcode.Generator;

// Create linear barcode object in C#
BarCode barcode = new BarCode();

// Set barcode symbology type to Code-39 in C#
barcode.SymbologyType = SymbologyType.Code39;

// Set Code39 barcode value in C#
barcode.CodeText = "CODE39";

// Set Code39 drawing image format to PNG in C#
barcode.Format = ImageFormat.Png;

// Generate Code-39 barcode & encode to the png image in C#
barcode.drawBarcode("C://barcode-code39-csharp.png");

// Generate Code-39 barcode & print to System.Drawing.Graphics object in C#
barcode.drawBarcode("Graphics object");

// Create Code-39 barcode & draw to System.IO.Stream object in C#
barcode.drawBarcode("Stream object");



或参考
使用c#生成Code 39条码



or refer to the code 39 barcode generation with c#


这篇关于如何生成代码39并存储在db中? (在c#.net中)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆